New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clerk/types

Package Overview
Dependencies
Maintainers
9
Versions
2273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clerk/types - npm Package Compare versions

Comparing version 2.0.0-alpha.8 to 2.0.0-alpha.9

dist/organization.d.ts

36

dist/authConfig.d.ts

@@ -1,38 +0,4 @@

import { EmailAddressVerificationStrategy } from './emailAddress';
import { ClerkResource } from './resource';
import { IdentificationStrategy, SignInStrategyName } from './signIn';
/**
* Authentication configuration attributes set.
*/
export interface AuthConfigResource extends ClerkResource {
id: string;
firstName: ToggleTypeWithRequire;
lastName: ToggleTypeWithRequire;
emailAddress: ToggleType;
phoneNumber: ToggleType;
username: ToggleType;
password: string;
/**
* Types of identification strategies selected.
*/
identificationStrategies: IdentificationStrategy[];
/**
* Combinations of strategies.
*/
identificationRequirements: IdentificationStrategy[][];
passwordConditions: any;
/**
* Type of first factor authentication used.
*/
firstFactors: SignInStrategyName[];
/**
* Type of second factor authentication used.
*/
secondFactors: SignInStrategyName[];
/**
* All the verification strategies that can be used in
* this instance to verify an email address.
*/
emailAddressVerificationStrategies: EmailAddressVerificationStrategy[];
/**
* Enabled single session configuration at the instance level.

@@ -42,4 +8,2 @@ */

}
export declare type ToggleType = 'on' | 'off';
export declare type ToggleTypeWithRequire = ToggleType | 'required';
//# sourceMappingURL=authConfig.d.ts.map

24

dist/clerk.d.ts

@@ -0,4 +1,7 @@

import { OrganizationMembershipResource } from '.';
import { EnvironmentResource } from '.';
import { ClientResource } from './client';
import { DisplayThemeJSON } from './json';
import { OrganizationResource } from './organization';
import { MembershipRole } from './organizationMembership';
import { ActiveSessionResource } from './session';

@@ -171,2 +174,14 @@ import { UserResource } from './user';

/**
* Creates an organization, adding the current user as admin.
*/
createOrganization: (params: CreateOrganizationParams) => Promise<OrganizationResource>;
/**
* Retrieves all the organizations the current user is a member of.
*/
getOrganizationMemberships: () => Promise<OrganizationMembershipResource[]>;
/**
* Retrieves a single organization by id.
*/
getOrganization: (organizationId: string) => Promise<OrganizationResource | undefined>;
/**
* Handles a 401 response from Frontend API by refreshing the client and session object accordingly

@@ -206,3 +221,2 @@ */

export interface ClerkOptions {
authVersion?: 1 | 2;
navigate?: (to: string) => Promise<unknown> | unknown;

@@ -305,2 +319,10 @@ polling?: boolean;

}
export declare type CreateOrganizationInvitationParams = {
emailAddress: string;
role: MembershipRole;
redirectUrl?: string;
};
export interface CreateOrganizationParams {
name: string;
}
export interface AuthenticateWithMetamaskParams {

@@ -307,0 +329,0 @@ redirectUrl?: string;

import { AuthConfigResource } from './authConfig';
import { DisplayConfigResource } from './displayConfig';
import { ClerkResource } from './resource';
import { UserSettingsResource } from './userSettings';
export interface EnvironmentResource extends ClerkResource {
userSettings: UserSettingsResource;
authConfig: AuthConfigResource;

@@ -6,0 +8,0 @@ displayConfig: DisplayConfigResource;

@@ -1,2 +0,2 @@

import { OAuthProvider } from '.';
import { OAuthProvider } from './oauth';
export interface ExternalAccountResource {

@@ -12,2 +12,5 @@ id: string;

avatarUrl: string;
username?: string;
publicMetadata: Record<string, unknown>;
label?: string;
providerSlug: () => OAuthProvider;

@@ -14,0 +17,0 @@ providerTitle: () => string;

@@ -14,2 +14,5 @@ export * from './api';

export * from './oauth';
export * from './organization';
export * from './organizationInvitation';
export * from './organizationMembership';
export * from './phoneNumber';

@@ -23,2 +26,3 @@ export * from './resource';

export * from './user';
export * from './userSettings';
export * from './utils';

@@ -25,0 +29,0 @@ export * from './verification';

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -26,2 +30,5 @@ if (k2 === undefined) k2 = k;

__exportStar(require("./oauth"), exports);
__exportStar(require("./organization"), exports);
__exportStar(require("./organizationInvitation"), exports);
__exportStar(require("./organizationMembership"), exports);
__exportStar(require("./phoneNumber"), exports);

@@ -35,2 +42,3 @@ __exportStar(require("./resource"), exports);

__exportStar(require("./user"), exports);
__exportStar(require("./userSettings"), exports);
__exportStar(require("./utils"), exports);

@@ -37,0 +45,0 @@ __exportStar(require("./verification"), exports);

/**
* Currently representing API DTOs in their JSON form.
*/
import { ToggleType, ToggleTypeWithRequire } from './authConfig';
import { EmailAddressVerificationStrategy } from './emailAddress';
import { OAuthStrategy } from './oauth';
import { OAuthProvider } from './oauth';
import { OAuthProvider, OAuthStrategy } from './oauth';
import { OrganizationInvitationStatus } from './organizationInvitation';
import { MembershipRole } from './organizationMembership';
import { SessionStatus } from './session';
import { IdentificationStrategy, PreferredSignInStrategy, SignInFactor, SignInIdentifier, SignInStatus, SignInStrategyName, UserData } from './signIn';
import { PreferredSignInStrategy, SignInFactor, SignInIdentifier, SignInStatus, UserData } from './signIn';
import { SignUpField, SignUpIdentificationField, SignUpStatus } from './signUp';
import { BoxShadow, Color, EmUnit, FontFamily, FontWeight, HexColor } from './theme';
import { UserSettingsJSON } from './userSettings';
import { VerificationStatus } from './verification';

@@ -68,2 +68,3 @@ export interface ClerkResourceJSON {

display_config: DisplayConfigJSON;
user_settings: UserSettingsJSON;
}

@@ -165,2 +166,5 @@ export interface ClientJSON extends ClerkResourceJSON {

avatar_url: string;
username: string;
public_metadata: Record<string, unknown>;
label: string;
}

@@ -194,2 +198,3 @@ export interface UserJSON extends ClerkResourceJSON {

identifier: string;
user_id?: string;
}

@@ -200,17 +205,3 @@ export interface SessionWithActivitiesJSON extends Omit<SessionJSON, 'user'> {

}
export interface AuthConfigJSON {
object: 'auth_config';
id: string;
first_name: ToggleTypeWithRequire;
last_name: ToggleTypeWithRequire;
email_address: ToggleType;
phone_number: ToggleType;
username: ToggleType;
password: ToggleTypeWithRequire;
identification_strategies: IdentificationStrategy[];
identification_requirements: IdentificationStrategy[][];
password_conditions: any;
first_factors: SignInStrategyName[];
second_factors: SignInStrategyName[];
email_address_verification_strategies: EmailAddressVerificationStrategy[];
export interface AuthConfigJSON extends ClerkResourceJSON {
single_session_mode: boolean;

@@ -261,2 +252,28 @@ }

}
export interface OrganizationJSON extends ClerkResourceJSON {
object: 'organization';
id: string;
name: string;
created_at: number;
updated_at: number;
}
export interface OrganizationMembershipJSON extends ClerkResourceJSON {
object: 'organization_membership';
id: string;
organization: OrganizationJSON;
public_user_data: PublicUserDataJSON;
role: MembershipRole;
created_at: number;
updated_at: number;
}
export interface OrganizationInvitationJSON extends ClerkResourceJSON {
object: 'organization_invitation';
id: string;
organization_id: string;
email_address: string;
status: OrganizationInvitationStatus;
role: MembershipRole;
created_at: number;
updated_at: number;
}
//# sourceMappingURL=json.d.ts.map

@@ -0,1 +1,2 @@

import { MembershipRole } from './organizationMembership';
export interface JWTClaims {

@@ -11,4 +12,6 @@ __raw: string;

name?: string;
orgs?: OrganizationsJWTClaim;
[key: string]: unknown;
}
export declare type OrganizationsJWTClaim = Record<string, MembershipRole>;
export interface JWT {

@@ -15,0 +18,0 @@ encoded: {

@@ -1,3 +0,16 @@

export declare type OAuthProvider = 'facebook' | 'google' | 'hubspot' | 'github' | 'tiktok' | 'gitlab' | 'discord' | 'twitter' | 'twitch' | 'linkedin' | 'dropbox' | 'bitbucket' | 'microsoft';
export declare type OAuthProvider = 'facebook' | 'google' | 'hubspot' | 'github' | 'tiktok' | 'gitlab' | 'discord' | 'twitter' | 'twitch' | 'linkedin' | 'dropbox' | 'bitbucket' | 'microsoft' | 'notion' | 'apple';
export declare type OAuthStrategy = `oauth_${OAuthProvider}`;
export interface OAuthProviderData {
provider: OAuthProvider;
strategy: OAuthStrategy;
name: string;
docsUrl: string;
}
export declare const OAUTH_PROVIDERS: OAuthProviderData[];
interface getOAuthProviderDataProps {
provider?: OAuthProvider;
strategy?: OAuthStrategy;
}
export declare function getOAuthProviderData({ provider, strategy }: getOAuthProviderDataProps): OAuthProviderData | undefined | null;
export declare function sortedOAuthProviders(sortingArray: OAuthStrategy[]): OAuthProviderData[];
export declare type AuthenticateWithRedirectParams = {

@@ -20,2 +33,3 @@ /**

};
export {};
//# sourceMappingURL=oauth.d.ts.map
"use strict";
exports.__esModule = true;
exports.sortedOAuthProviders = exports.getOAuthProviderData = exports.OAUTH_PROVIDERS = void 0;
exports.OAUTH_PROVIDERS = [
{
provider: 'google',
strategy: 'oauth_google',
name: 'Google',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/social-login-google'
},
{
provider: 'discord',
strategy: 'oauth_discord',
name: 'Discord',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/discord'
},
{
provider: 'facebook',
strategy: 'oauth_facebook',
name: 'Facebook',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/social-login-facebook'
},
{
provider: 'twitch',
strategy: 'oauth_twitch',
name: 'Twitch',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/twitch'
},
{
provider: 'twitter',
strategy: 'oauth_twitter',
name: 'Twitter',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/twitter'
},
{
provider: 'microsoft',
strategy: 'oauth_microsoft',
name: 'Microsoft',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/microsoft'
},
{
provider: 'tiktok',
strategy: 'oauth_tiktok',
name: 'TikTok',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/tiktok'
},
{
provider: 'linkedin',
strategy: 'oauth_linkedin',
name: 'LinkedIn',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/linkedin'
},
{
provider: 'github',
strategy: 'oauth_github',
name: 'GitHub',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/github'
},
{
provider: 'gitlab',
strategy: 'oauth_gitlab',
name: 'GitLab',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/gitlab'
},
{
provider: 'dropbox',
strategy: 'oauth_dropbox',
name: 'Dropbox',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/dropbox'
},
{
provider: 'bitbucket',
strategy: 'oauth_bitbucket',
name: 'Bitbucket',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/bitbucket'
},
{
provider: 'hubspot',
strategy: 'oauth_hubspot',
name: 'HubSpot',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/hubspot'
},
{
provider: 'notion',
strategy: 'oauth_notion',
name: 'Notion',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/notion'
},
{
provider: 'apple',
strategy: 'oauth_apple',
name: 'Apple',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/apple'
},
];
function getOAuthProviderData(_a) {
var provider = _a.provider, strategy = _a.strategy;
if (provider) {
return exports.OAUTH_PROVIDERS.find(function (oauth_provider) { return oauth_provider.provider == provider; });
}
return exports.OAUTH_PROVIDERS.find(function (oauth_provider) { return oauth_provider.strategy == strategy; });
}
exports.getOAuthProviderData = getOAuthProviderData;
function sortedOAuthProviders(sortingArray) {
return exports.OAUTH_PROVIDERS
.slice()
.sort(function (a, b) {
var aPos = sortingArray.indexOf(a.strategy);
if (aPos == -1) {
aPos = Number.MAX_SAFE_INTEGER;
}
var bPos = sortingArray.indexOf(b.strategy);
if (bPos == -1) {
bPos = Number.MAX_SAFE_INTEGER;
}
return aPos - bPos;
});
}
exports.sortedOAuthProviders = sortedOAuthProviders;
//# sourceMappingURL=oauth.js.map

@@ -48,3 +48,4 @@ import { ClerkResource } from './resource';

identifier: string;
userId?: string;
}
//# sourceMappingURL=session.d.ts.map

@@ -35,3 +35,3 @@ import { EmailAddressVerificationStrategy } from './emailAddress';

export declare type IdentificationStrategy = SignInIdentifier | OAuthStrategy;
export declare type SignInStrategyName = 'password' | 'phone_code' | Web3Strategy | EmailAddressVerificationStrategy | OAuthStrategy;
export declare type SignInStrategyName = 'password' | 'phone_code' | Web3Strategy | EmailAddressVerificationStrategy | OAuthStrategy | 'ticket';
export declare type SignInStatus = 'needs_identifier' | 'needs_first_factor' | 'needs_second_factor' | 'complete';

@@ -110,2 +110,7 @@ export declare type PreferredSignInStrategy = 'password' | 'otp';

/**
* Organization invitation ticket.
* The logic is handled by the backend after the token and strategy is sent.
*/
ticket?: string;
/**
* Optional if the strategy is one of the OAuth providers.

@@ -112,0 +117,0 @@ * If the OAuth verification results in a completed Sign in, this is the URL that

@@ -46,2 +46,3 @@ import { EmailAddressVerificationStrategy, PrepareEmailAddressVerificationParams } from './emailAddress';

export declare type SignUpAttribute = 'first_name' | 'last_name' | 'password' | 'birthday' | 'gender';
declare type OrganizationSignUpStrategy = 'ticket';
export declare type SignUpAttributes = {

@@ -51,3 +52,3 @@ external_account_strategy: string;

external_account_action_complete_redirect_url: string;
strategy: OAuthStrategy;
strategy: OAuthStrategy | OrganizationSignUpStrategy;
redirect_url: string;

@@ -58,2 +59,3 @@ action_complete_redirect_url: string;

invitation_token: string;
ticket: string;
} & Record<SignUpAttribute | Exclude<SignUpIdentification, OAuthStrategy>, string>;

@@ -78,2 +80,3 @@ export declare type SignUpParams = Partial<SnakeToCamel<SignUpAttributes> & SignUpAttributes>;

} & VerificationAttemptParams;
export {};
//# sourceMappingURL=signUp.d.ts.map

@@ -56,4 +56,5 @@ import { ClerkResourceJSON } from './json';

enabledFirstFactorIdentifiers: Attribute[];
instanceIsPasswordBased: boolean;
}
export {};
//# sourceMappingURL=userSettings.d.ts.map
{
"name": "@clerk/types",
"version": "2.0.0-alpha.8",
"version": "2.0.0-alpha.9",
"license": "MIT",

@@ -35,3 +35,3 @@ "description": "Typings for Clerk libraries.",

"typedoc": "^0.22.11",
"typescript": "4.5.5"
"typescript": "^4.6.2"
},

@@ -52,3 +52,3 @@ "engines": {

"homepage": "https://clerk.dev/",
"gitHead": "722ba9b52c24f878c34b3c4109a76c8b1454f02d"
"gitHead": "512055698ef62a9c760afb092aac0ca33a8e5408"
}

@@ -0,3 +1,94 @@

<p align="center">
<a href="https://clerk.dev?utm_source=github&utm_medium=clerk_types" target="_blank" rel="noopener noreferrer">
<img src="https://images.clerk.dev/static/clerk.svg" alt="Clerk logo" height="50">
</a>
<br />
</p>
# @clerk/types
Typings for Clerk.dev libraries.
<div align="center">
[![Chat on Discord](https://img.shields.io/discord/856971667393609759.svg?logo=discord)](https://discord.com/invite/b5rXHjAg7A)
[![Clerk documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://docs.clerk.dev?utm_source=github&utm_medium=clerk_types)
[![Follow on Twitter](https://img.shields.io/twitter/follow/ClerkDev?style=social)](https://twitter.com/intent/follow?screen_name=ClerkDev)
[Changelog](CHANGELOG.md)
·
[Report a Bug](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=bug&template=bug_report.md&title=Bug%3A+)
·
[Request a Feature](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=Feature%3A+)
·
[Ask a Question](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+)
</div>
---
## Overview
This package provides the TypeScript type declarations for Clerk libraries.
## Getting Started
It is worth noting that Clerk packages automatically include their type declarations when installed so adding this package manually is not typically necessary.
### Installation
```sh
npm install --save-dev @clerk/types
```
### Build
```sh
npm run build
```
To build types in watch mode, run the following:
```sh
npm run dev
```
## Usage
Example implementation:
```ts
import type { OAuthStrategy } from '@clerk/types';
export type OAuthProps = {
oAuthOptions: OAuthStrategy[];
error?: string;
setError?: React.Dispatch<React.SetStateAction<string | undefined>>;
};
```
_For further details and examples, please refer to our [Documentation](https://docs.clerk.dev?utm_source=github&utm_medium=clerk_types)._
## Support
You can get in touch with us in any of the following ways:
- Join our official community [Discord server](https://discord.com/invite/b5rXHjAg7A)
- Open a [GitHub support issue](https://github.com/clerkinc/javascript/issues/new?assignees=&labels=question&template=ask_a_question.md&title=Support%3A+)
- Contact options listed on [our Support page](https://clerk.dev/support?utm_source=github&utm_medium=clerk_types)
## Contributing
We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](docs/CONTRIBUTING.md).
## Security
`@clerk/types` follows good practices of security, but 100% security cannot be assured.
`@clerk/types` is provided **"as is"** without any **warranty**. Use at your own risk.
_For more information and to report security issues, please refer to our [security documentation](docs/SECURITY.md)._
## License
This project is licensed under the **MIT license**.
See [LICENSE](LICENSE) for more information.

@@ -1,53 +0,5 @@

import { EmailAddressVerificationStrategy } from './emailAddress';
import { ClerkResource } from './resource';
import { IdentificationStrategy, SignInStrategyName } from './signIn';
/**
* Authentication configuration attributes set.
*/
export interface AuthConfigResource extends ClerkResource {
id: string;
firstName: ToggleTypeWithRequire;
lastName: ToggleTypeWithRequire;
emailAddress: ToggleType;
phoneNumber: ToggleType;
username: ToggleType;
password: string;
/**
* Types of identification strategies selected.
*/
identificationStrategies: IdentificationStrategy[];
/**
* Combinations of strategies.
*/
identificationRequirements: IdentificationStrategy[][];
passwordConditions: any;
/**
* Type of first factor authentication used.
*/
firstFactors: SignInStrategyName[];
/**
* Type of second factor authentication used.
*/
secondFactors: SignInStrategyName[];
/**
* All the verification strategies that can be used in
* this instance to verify an email address.
*/
emailAddressVerificationStrategies: EmailAddressVerificationStrategy[];
/**
* Enabled single session configuration at the instance level.

@@ -57,5 +9,1 @@ */

}
export type ToggleType = 'on' | 'off';
export type ToggleTypeWithRequire = ToggleType | 'required';

@@ -0,4 +1,7 @@

import { OrganizationMembershipResource } from '.';
import { EnvironmentResource } from '.';
import { ClientResource } from './client';
import { DisplayThemeJSON } from './json';
import { OrganizationResource } from './organization';
import { MembershipRole } from './organizationMembership';
import { ActiveSessionResource } from './session';

@@ -221,2 +224,21 @@ import { UserResource } from './user';

/**
* Creates an organization, adding the current user as admin.
*/
createOrganization: (
params: CreateOrganizationParams,
) => Promise<OrganizationResource>;
/**
* Retrieves all the organizations the current user is a member of.
*/
getOrganizationMemberships: () => Promise<OrganizationMembershipResource[]>;
/**
* Retrieves a single organization by id.
*/
getOrganization: (
organizationId: string,
) => Promise<OrganizationResource | undefined>;
/**
* Handles a 401 response from Frontend API by refreshing the client and session object accordingly

@@ -266,3 +288,2 @@ */

export interface ClerkOptions {
authVersion?: 1 | 2;
navigate?: (to: string) => Promise<unknown> | unknown;

@@ -418,2 +439,12 @@ polling?: boolean;

export type CreateOrganizationInvitationParams = {
emailAddress: string;
role: MembershipRole;
redirectUrl?: string;
};
export interface CreateOrganizationParams {
name: string;
}
export interface AuthenticateWithMetamaskParams {

@@ -420,0 +451,0 @@ redirectUrl?: string;

import { AuthConfigResource } from './authConfig';
import { DisplayConfigResource } from './displayConfig';
import { ClerkResource } from './resource';
import { UserSettingsResource } from './userSettings';
export interface EnvironmentResource extends ClerkResource {
userSettings: UserSettingsResource;
authConfig: AuthConfigResource;

@@ -7,0 +9,0 @@ displayConfig: DisplayConfigResource;

@@ -1,2 +0,2 @@

import { OAuthProvider } from '.';
import { OAuthProvider } from './oauth';

@@ -13,5 +13,7 @@ export interface ExternalAccountResource {

avatarUrl: string;
username?: string;
publicMetadata: Record<string, unknown>;
label?: string;
providerSlug: () => OAuthProvider;
providerTitle: () => string;
}

@@ -14,2 +14,5 @@ export * from './api';

export * from './oauth';
export * from './organization';
export * from './organizationInvitation';
export * from './organizationMembership';
export * from './phoneNumber';

@@ -23,2 +26,3 @@ export * from './resource';

export * from './user';
export * from './userSettings';
export * from './utils';

@@ -25,0 +29,0 @@ export * from './verification';

@@ -5,9 +5,7 @@ /**

import { ToggleType, ToggleTypeWithRequire } from './authConfig';
import { EmailAddressVerificationStrategy } from './emailAddress';
import { OAuthStrategy } from './oauth';
import { OAuthProvider } from './oauth';
import { OAuthProvider, OAuthStrategy } from './oauth';
import { OrganizationInvitationStatus } from './organizationInvitation';
import { MembershipRole } from './organizationMembership';
import { SessionStatus } from './session';
import {
IdentificationStrategy,
PreferredSignInStrategy,

@@ -17,3 +15,2 @@ SignInFactor,

SignInStatus,
SignInStrategyName,
UserData,

@@ -30,2 +27,3 @@ } from './signIn';

} from './theme';
import { UserSettingsJSON } from './userSettings';
import { VerificationStatus } from './verification';

@@ -93,2 +91,3 @@

display_config: DisplayConfigJSON;
user_settings: UserSettingsJSON;
}

@@ -199,2 +198,5 @@

avatar_url: string;
username: string;
public_metadata: Record<string, unknown>;
label: string;
}

@@ -230,2 +232,3 @@

identifier: string;
user_id?: string;
}

@@ -236,20 +239,5 @@

latest_activity: SessionActivityJSON;
// activities: SessionActivityJSON[];
}
export interface AuthConfigJSON {
object: 'auth_config';
id: string;
first_name: ToggleTypeWithRequire;
last_name: ToggleTypeWithRequire;
email_address: ToggleType;
phone_number: ToggleType;
username: ToggleType;
password: ToggleTypeWithRequire;
identification_strategies: IdentificationStrategy[];
identification_requirements: IdentificationStrategy[][];
password_conditions: any;
first_factors: SignInStrategyName[];
second_factors: SignInStrategyName[];
email_address_verification_strategies: EmailAddressVerificationStrategy[];
export interface AuthConfigJSON extends ClerkResourceJSON {
single_session_mode: boolean;

@@ -306,1 +294,30 @@ }

}
export interface OrganizationJSON extends ClerkResourceJSON {
object: 'organization';
id: string;
name: string;
created_at: number;
updated_at: number;
}
export interface OrganizationMembershipJSON extends ClerkResourceJSON {
object: 'organization_membership';
id: string;
organization: OrganizationJSON;
public_user_data: PublicUserDataJSON;
role: MembershipRole;
created_at: number;
updated_at: number;
}
export interface OrganizationInvitationJSON extends ClerkResourceJSON {
object: 'organization_invitation';
id: string;
organization_id: string;
email_address: string;
status: OrganizationInvitationStatus;
role: MembershipRole;
created_at: number;
updated_at: number;
}

@@ -0,1 +1,3 @@

import { MembershipRole } from './organizationMembership';
export interface JWTClaims {

@@ -11,5 +13,7 @@ __raw: string;

name?: string;
orgs?: OrganizationsJWTClaim;
[key: string]: unknown;
}
export type OrganizationsJWTClaim = Record<string, MembershipRole>;
// eslint-disable-next-line @typescript-eslint/naming-convention

@@ -16,0 +20,0 @@ export interface JWT {

@@ -14,6 +14,141 @@ export type OAuthProvider =

| 'bitbucket'
| 'microsoft';
| 'microsoft'
| 'notion'
| 'apple';
export type OAuthStrategy = `oauth_${OAuthProvider}`;
export interface OAuthProviderData {
provider: OAuthProvider;
strategy: OAuthStrategy,
name: string;
docsUrl: string;
}
export const OAUTH_PROVIDERS: OAuthProviderData[] = [
{
provider: 'google',
strategy: 'oauth_google',
name: 'Google',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/social-login-google',
},
{
provider: 'discord',
strategy: 'oauth_discord',
name: 'Discord',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/discord',
},
{
provider: 'facebook',
strategy: 'oauth_facebook',
name: 'Facebook',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/social-login-facebook',
},
{
provider: 'twitch',
strategy: 'oauth_twitch',
name: 'Twitch',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/twitch',
},
{
provider: 'twitter',
strategy: 'oauth_twitter',
name: 'Twitter',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/twitter',
},
{
provider: 'microsoft',
strategy: 'oauth_microsoft',
name: 'Microsoft',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/microsoft',
},
{
provider: 'tiktok',
strategy: 'oauth_tiktok',
name: 'TikTok',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/tiktok',
},
{
provider: 'linkedin',
strategy: 'oauth_linkedin',
name: 'LinkedIn',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/linkedin',
},
{
provider: 'github',
strategy: 'oauth_github',
name: 'GitHub',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/github',
},
{
provider: 'gitlab',
strategy: 'oauth_gitlab',
name: 'GitLab',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/gitlab',
},
{
provider: 'dropbox',
strategy: 'oauth_dropbox',
name: 'Dropbox',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/dropbox',
},
{
provider: 'bitbucket',
strategy: 'oauth_bitbucket',
name: 'Bitbucket',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/bitbucket',
},
{
provider: 'hubspot',
strategy: 'oauth_hubspot',
name: 'HubSpot',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/hubspot',
},
{
provider: 'notion',
strategy: 'oauth_notion',
name: 'Notion',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/notion',
},
{
provider: 'apple',
strategy: 'oauth_apple',
name: 'Apple',
docsUrl: 'https://docs.clerk.dev/reference/social-login-reference/apple',
},
];
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);
}
export function sortedOAuthProviders(sortingArray: OAuthStrategy[]) {
return OAUTH_PROVIDERS
.slice()
.sort(
(a, b) => {
let aPos = sortingArray.indexOf(a.strategy);
if (aPos == -1) {
aPos = Number.MAX_SAFE_INTEGER;
}
let bPos = sortingArray.indexOf(b.strategy);
if (bPos == -1) {
bPos = Number.MAX_SAFE_INTEGER;
}
return aPos - bPos;
}
)
}
export type AuthenticateWithRedirectParams = {

@@ -20,0 +155,0 @@ /**

@@ -61,2 +61,3 @@ import { ClerkResource } from './resource';

identifier: string;
userId?: string;
}

@@ -73,3 +73,4 @@ import { EmailAddressVerificationStrategy } from './emailAddress';

| EmailAddressVerificationStrategy
| OAuthStrategy;
| OAuthStrategy
| 'ticket';

@@ -182,2 +183,8 @@ export type SignInStatus =

/**
* Organization invitation ticket.
* The logic is handled by the backend after the token and strategy is sent.
*/
ticket?: string;
/**
* Optional if the strategy is one of the OAuth providers.

@@ -184,0 +191,0 @@ * If the OAuth verification results in a completed Sign in, this is the URL that

@@ -109,2 +109,4 @@ import {

type OrganizationSignUpStrategy = 'ticket';
export type SignUpAttributes = {

@@ -114,3 +116,3 @@ external_account_strategy: string;

external_account_action_complete_redirect_url: string;
strategy: OAuthStrategy;
strategy: OAuthStrategy | OrganizationSignUpStrategy;
redirect_url: string;

@@ -121,2 +123,3 @@ action_complete_redirect_url: string;

invitation_token: string;
ticket: string;
} & Record<

@@ -123,0 +126,0 @@ SignUpAttribute | Exclude<SignUpIdentification, OAuthStrategy>,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc