import {Nullable} from '../utils'; export interface CryptoOnrampInitOptions { theme: 'stripe' | 'night' | 'flat'; /** * Disables animations throughout Elements. Defaults to false. */ disableAnimations?: boolean; variables?: { // General font styles fontFamily?: string; fontSmooth?: string; fontVariantLigatures?: string; fontVariationSettings?: string; fontLineHeight?: string; // Font sizes fontSizeBase?: string; fontSizeSm?: string; fontSizeXs?: string; fontSize2Xs?: string; fontSize3Xs?: string; fontSizeLg?: string; fontSizeXl?: string; // Font weights fontWeightLight?: string; fontWeightNormal?: string; fontWeightMedium?: string; fontWeightBold?: string; // Spacing spacingUnit?: string; gridRowSpacing?: string; gridColumnSpacing?: string; tabSpacing?: string; accordionItemSpacing?: string; // Colors colorPrimary?: string; colorBackground?: string; colorText?: string; colorSuccess?: string; colorDanger?: string; colorWarning?: string; // Button Colors buttonColorBackground?: string; buttonColorText?: string; // Text variations colorTextSecondary?: string; colorTextPlaceholder?: string; // Accessible text accessibleColorOnColorPrimary?: string; accessibleColorOnColorBackground?: string; accessibleColorOnColorSuccess?: string; accessibleColorOnColorDanger?: string; accessibleColorOnColorWarning?: string; // Icons iconColor?: string; iconHoverColor?: string; iconCardErrorColor?: string; iconCardCvcColor?: string; iconCardCvcErrorColor?: string; iconCheckmarkColor?: string; iconChevronDownColor?: string; iconChevronDownHoverColor?: string; iconCloseColor?: string; iconCloseHoverColor?: string; iconLoadingIndicatorColor?: string; iconMenuColor?: string; iconMenuHoverColor?: string; iconPasscodeDeviceColor?: string; iconPasscodeDeviceHoverColor?: string; iconPasscodeDeviceNotificationColor?: string; iconRedirectColor?: string; // TabIcons tabIconColor?: string; tabIconHoverColor?: string; tabIconSelectedColor?: string; tabIconMoreColor?: string; tabIconMoreHoverColor?: string; // Logos logoColor?: string; tabLogoColor?: string; tabLogoSelectedColor?: string; blockLogoColor?: string; // Focus focusBoxShadow?: string; focusOutline?: string; // Radius buttonBorderRadius?: string; borderRadius?: string; }; rules?: { [selector: string]: { [cssPropertyName: string]: string; }; }; /** * The style of labels associated with input fields to use for the Elements. Defaults to 'auto'. * @docs https://stripe.com/docs/stripe-js/appearance-api#labels */ labels?: 'auto' | 'above' | 'floating'; /** * The style of input fields to use for the Elements. Defaults to 'spaced'. * @docs https://stripe.com/docs/stripe-js/appearance-api#inputs */ inputs?: 'spaced' | 'condensed'; expressCheckoutOptions?: { // https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-buttonHeight buttonHeight?: number; // https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-buttonTheme buttonTheme?: { applePay?: 'black' | 'white' | 'white-outline'; googlePay?: 'black' | 'white'; }; }; } export type DateOfBirth = { day: number; month: number; year: number; }; export type Address = { country: string; city?: string; line1?: string; line2?: string; postal_code?: string; state?: string; town?: string; }; export type IdNumber = { type: 'us_ssn'; value: string; }; export type KycInfo = { given_name?: string; surname?: string; address?: Address; id_number?: IdNumber; date_of_birth?: DateOfBirth; nationalities?: string[]; birth_country?: string; birth_city?: string; }; export type CryptoNetwork = | 'bitcoin' | 'ethereum' | 'solana' | 'polygon' | 'stellar' | 'avalanche' | 'base' | 'aptos' | 'optimism' | 'worldchain' | 'xrpl' | 'sui' | 'tempo' | 'arbitrum'; export type CryptoConsumerWallet = { id: string; object: 'crypto.consumer_wallet'; wallet_address: string; network: string; verified_ownership?: boolean; }; export type WalletOwnershipChallenge = { challengeId: string; walletAddress: string; network: CryptoNetwork; message: string; expiresAt: string; }; export type AuthenticationResult = { crypto_customer_id?: string; result: 'success' | 'abandoned' | 'declined'; }; export type CollectPaymentMethodOptions = { payment_method_types: string[]; wallets: { applePay: 'auto' | 'never' | 'always'; googlePay: 'auto' | 'never' | 'always'; }; }; export type CardPaymentMethodDetails = { brand: string; exp_month: number; exp_year: number; funding: string; last4: string; wallet: {type: 'apple_pay' | 'google_pay'} | null; }; export type UsBankAccountPaymentMethodDetails = { account_type: 'checking' | 'savings' | null; bank_name: string | null; last4: string; }; export type PaymentMethodDetails = | {type: 'card'; card: CardPaymentMethodDetails} | { type: 'us_bank_account'; us_bank_account: UsBankAccountPaymentMethodDetails; }; export type CollectPaymentMethodOnCompletionRequest = { cryptoPaymentToken: string; paymentMethodDetails: PaymentMethodDetails | null; }; export type DocumentVerificationResult = { result: 'success' | 'abandoned'; }; export type RegisterLinkUserResult = { created: boolean; }; export type CheckoutResult = { successful: boolean; }; export type CrsCarfDeclarationResult = { result: 'confirmed' | 'abandoned'; }; export type IdentifierType = | 'at_stn' | 'be_nrn' | 'bg_ucn' | 'cy_tic' | 'cz_rc' | 'de_stn' | 'dk_cpr' | 'ee_ik' | 'es_nif' | 'fi_hetu' | 'fr_nir' | 'fr_spi' | 'gr_afm' | 'hr_oib' | 'hu_ad' | 'ie_ppsn' | 'is_kt' | 'it_cf' | 'lt_ak' | 'lu_nif' | 'lv_pk' | 'mt_nic' | 'mt_pp' | 'nl_bsn' | 'pl_pesel' | 'pl_nip' | 'pt_nif' | 'ro_cnp' | 'se_pin' | 'si_pin' | 'sk_rc'; export type RegulationType = 'eu_carf' | 'eu_mica'; export type Identifier = { type: IdentifierType; value: string; }; export type IdentifierRequirement = { type: IdentifierType; regulation: RegulationType; }; export type AlternativeGroup = { original_missing_identifiers: IdentifierType[]; alternative_missing_identifiers: IdentifierType[]; }; export type IdentifierRequirements = { identifiers: IdentifierRequirement[]; alternatives: AlternativeGroup[]; carf_tin_required: boolean; }; export type UpdateKycResult = { completed: boolean; identifiers: IdentifierRequirement[]; alternatives: AlternativeGroup[]; invalid_identifiers: string[]; carf_tin_required: boolean; }; export interface OnrampCoordinator { registerLinkUser: ( email: string, phone: string, country: string, fullName?: string ) => Promise; authenticate: ( linkAuthIntentId: string, onCompletion: (result: AuthenticationResult) => void ) => Promise>; submitKycInfo: (params: KycInfo) => Promise; registerWalletAddress: ( walletAddress: string, network: CryptoNetwork ) => Promise; deleteWalletAddress: (walletId: string) => Promise; getWalletOwnershipChallenge: (params: { walletAddress: string; network: CryptoNetwork; }) => Promise; submitWalletOwnershipSignature: (params: { challengeId: string; signature: string; }) => Promise; collectPaymentMethod: ( options: CollectPaymentMethodOptions, onCompletion: (request: CollectPaymentMethodOnCompletionRequest) => void ) => Promise; verifyDocuments: () => Promise; performCheckout: ( onrampSessionId: string, checkout: (onrampSessionId: string) => Promise ) => Promise; getMissingIdentifiers: () => Promise; updateKycInfo: (identifiers: Identifier[]) => Promise; promptUserAttestation: ( regulation: RegulationType, onCompletion: (result: CrsCarfDeclarationResult) => void ) => Promise; destroy: () => void; } /** * The Embedded Components CryptoOnramp SDK instance. */ export interface CryptoOnramp {} /** * Use `CryptoOnrampConstructor(publishableKey, options)` to create an instance * of the Embedded Components `CryptoOnramp` object. */ export interface CryptoOnrampConstructor { ( publishableKey: string, options?: CryptoOnrampInitOptions ): OnrampCoordinator; }