UNPKG

@clerk/shared

Version:

Internal package utils used by the Clerk SDKs

106 lines (105 loc) 5.49 kB
import { ClerkResource } from "./resource.js"; import { ValidatePasswordCallbacks } from "./passwords.js"; import { AuthenticateWithPopupParams, AuthenticateWithRedirectParams } from "./redirects.js"; import { CreateEmailLinkFlowReturn, StartEmailLinkFlowParams } from "./verification.js"; import { AttemptVerificationParams, PrepareVerificationParams, ProtectCheckResource, SignUpAuthenticateWithSolanaParams, SignUpAuthenticateWithWeb3Params, SignUpCreateParams, SignUpField, SignUpIdentificationField, SignUpStatus, SignUpUpdateParams, SignUpVerificationsResource } from "./signUpCommon.js"; import { AttemptWeb3WalletVerificationParams, AuthenticateWithWeb3Params, PrepareWeb3WalletVerificationParams } from "./web3Wallet.js"; import { SignUpJSONSnapshot } from "./snapshots.js"; import { AttemptEmailAddressVerificationParams, PrepareEmailAddressVerificationParams } from "./emailAddress.js"; import { AttemptPhoneNumberVerificationParams, PreparePhoneNumberVerificationParams } from "./phoneNumber.js"; import { SignUpFutureResource } from "./signUpFuture.js"; //#region src/types/signUp.d.ts declare global { /** * If you want to provide custom types for the signUp.unsafeMetadata object, * simply redeclare this rule in the global namespace. * Every user object will use the provided type. */ interface SignUpUnsafeMetadata { [k: string]: unknown; } } /** * The `SignUp` object holds the state of the current sign-up and provides helper methods to navigate and complete the sign-up process. Once a sign-up is complete, a new user is created. */ interface SignUpResource extends ClerkResource { /** * The current status of the sign-up. */ status: SignUpStatus | null; requiredFields: SignUpField[]; optionalFields: SignUpField[]; missingFields: SignUpField[]; unverifiedFields: SignUpIdentificationField[]; verifications: SignUpVerificationsResource; /** * The current protect check challenge, if one is pending. Mid-flow fraud-prevention gate * issued by Clerk Protect. When non-null, the client must load the SDK at `sdkUrl`, run the * challenge with `token`, and submit the resulting proof token via `submitProtectCheck`. * Only populated when Protect mid-flow challenges are explicitly enabled for the instance; * upgrading the SDK alone does not enable it. */ protectCheck: ProtectCheckResource | null; username: string | null; firstName: string | null; lastName: string | null; emailAddress: string | null; phoneNumber: string | null; web3wallet: string | null; hasPassword: boolean; unsafeMetadata: SignUpUnsafeMetadata; createdSessionId: string | null; createdUserId: string | null; abandonAt: number | null; legalAcceptedAt: number | null; locale: string | null; create: (params: SignUpCreateParams) => Promise<SignUpResource>; update: (params: SignUpUpdateParams) => Promise<SignUpResource>; upsert: (params: SignUpCreateParams | SignUpUpdateParams) => Promise<SignUpResource>; prepareVerification: (params: PrepareVerificationParams) => Promise<SignUpResource>; attemptVerification: (params: AttemptVerificationParams) => Promise<SignUpResource>; prepareEmailAddressVerification: (params?: PrepareEmailAddressVerificationParams) => Promise<SignUpResource>; attemptEmailAddressVerification: (params: AttemptEmailAddressVerificationParams) => Promise<SignUpResource>; preparePhoneNumberVerification: (params?: PreparePhoneNumberVerificationParams) => Promise<SignUpResource>; attemptPhoneNumberVerification: (params: AttemptPhoneNumberVerificationParams) => Promise<SignUpResource>; prepareWeb3WalletVerification: (params?: PrepareWeb3WalletVerificationParams) => Promise<SignUpResource>; attemptWeb3WalletVerification: (params: AttemptWeb3WalletVerificationParams) => Promise<SignUpResource>; createEmailLinkFlow: () => CreateEmailLinkFlowReturn<StartEmailLinkFlowParams, SignUpResource>; validatePassword: (password: string, callbacks?: ValidatePasswordCallbacks) => void; authenticateWithRedirect: (params: AuthenticateWithRedirectParams & { unsafeMetadata?: SignUpUnsafeMetadata; }) => Promise<void>; authenticateWithPopup: (params: AuthenticateWithPopupParams & { unsafeMetadata?: SignUpUnsafeMetadata; }) => Promise<void>; authenticateWithWeb3: (params: AuthenticateWithWeb3Params & { unsafeMetadata?: SignUpUnsafeMetadata; legalAccepted?: boolean; }) => Promise<SignUpResource>; submitProtectCheck: (params: { proofToken: string; }) => Promise<SignUpResource>; authenticateWithMetamask: (params?: SignUpAuthenticateWithWeb3Params) => Promise<SignUpResource>; authenticateWithCoinbaseWallet: (params?: SignUpAuthenticateWithWeb3Params) => Promise<SignUpResource>; authenticateWithOKXWallet: (params?: SignUpAuthenticateWithWeb3Params) => Promise<SignUpResource>; authenticateWithBase: (params?: SignUpAuthenticateWithWeb3Params) => Promise<SignUpResource>; authenticateWithSolana: (params: SignUpAuthenticateWithSolanaParams) => Promise<SignUpResource>; __internal_toSnapshot: () => SignUpJSONSnapshot; /** * @internal */ __internal_future: SignUpFutureResource; /** * @experimental */ __experimental_getEnterpriseConnections: () => Promise<SignUpEnterpriseConnectionResource[]>; } /** * @experimental */ interface SignUpEnterpriseConnectionResource extends ClerkResource { id: string; name: string; } //#endregion export { SignUpEnterpriseConnectionResource, SignUpResource };