@privy-io/react-auth 1.59.0 → 1.59.1-beta-20240306174853

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -362,10 +362,12 @@ declare enum PrivyErrorCode {
362
362
  INVALID_CAPTCHA = "invalid_captcha",
363
363
  LINKED_TO_ANOTHER_USER = "linked_to_another_user",
364
364
  CANNOT_LINK_MORE_OF_TYPE = "cannot_link_more_of_type",
365
+ FAILED_TO_LINK_ACCOUNT = "failed_to_link_account",
365
366
  ALLOWLIST_REJECTED = "allowlist_rejected",
366
367
  OAUTH_USER_DENIED = "oauth_user_denied",
367
368
  UNKNOWN_AUTH_ERROR = "unknown_auth_error",
368
369
  USER_EXITED_AUTH_FLOW = "exited_auth_flow",
370
+ USER_EXITED_LINK_FLOW = "exited_link_flow",
369
371
  USER_EXITED_SET_PASSWORD_FLOW = "user_exited_set_password_flow",
370
372
  MUST_BE_AUTHENTICATED = "must_be_authenticated",
371
373
  UNKNOWN_CONNECT_WALLET_ERROR = "unknown_connect_wallet_error",
@@ -2640,6 +2642,22 @@ interface PrivyEvents {
2640
2642
  */
2641
2643
  onError?: CallbackError;
2642
2644
  };
2645
+ linkAccount: {
2646
+ /**
2647
+ * Callback that will execute once on a successful linking of a new account/login method.
2648
+ * This will run when any of the 'link' methods are called manually.
2649
+ * @param user {@link User}- the user the account was linked to
2650
+ * @param linkedAccountType {@link LoginMethod}- the type of linked account
2651
+ */
2652
+ onSuccess?: (user: User, linkedAccountType: LoginMethod) => void;
2653
+ /**
2654
+ * Callback that will execute in the case of a non-successful account linking.
2655
+ *
2656
+ * @param error {PrivyErrorCode} - the corresponding error code
2657
+ *
2658
+ */
2659
+ onError?: CallbackError;
2660
+ };
2643
2661
  configureMfa: {
2644
2662
  /**
2645
2663
  * Callback that will execute when MFA is required to complete a given action.
@@ -2870,6 +2888,41 @@ declare const useLoginWithSms: () => UseLoginWithSms;
2870
2888
  */
2871
2889
  declare function useRegisterMfaListener(callbacks: PrivyEvents['configureMfa']): void;
2872
2890
 
2891
+ /**
2892
+ * Use this hook to link a new account to an authenticated user, and to attach
2893
+ * callbacks for success and errors.
2894
+ *
2895
+ * @param callbacks.onComplete {@link PrivyEvents} callback to execute for already- or newly-`authenticated` users
2896
+ * @param callbacks.onError {@link PrivyEvents} callback to execute if there is an error during `link`.
2897
+ *
2898
+ * @returns linkEmail - opens the Privy modal and prompts the user to link an email address
2899
+ * @returns linkPhone - opens the Privy modal and prompts the user to link a phone number
2900
+ * @returns linkWallet - opens the Privy modal and prompts the user to link an external wallet
2901
+ * @returns linkGoogle - opens the Privy modal and prompts the user to link their Google account
2902
+ * @returns linkApple - opens the Privy modal and prompts the user to link their Apple account
2903
+ * @returns linkTwitter - opens the Privy modal and prompts the user to link their Twitter account
2904
+ * @returns linkDiscord - opens the Privy modal and prompts the user to link their Discord account
2905
+ * @returns linkGithub - opens the Privy modal and prompts the user to link their Github account
2906
+ * @returns linkLinkedIn - opens the Privy modal and prompts the user to link their LinkedIn account
2907
+ * @returns linkTikTok - opens the Privy modal and prompts the user to link their TikTok account
2908
+ * @returns linkSpotify - opens the Privy modal and prompts the user to link their Spotify account
2909
+ * @returns linkFarcaster - opens the Privy modal and prompts the user to link their Farcaster account
2910
+ */
2911
+ declare function useLinkAccount(callbacks?: PrivyEvents['linkAccount']): {
2912
+ linkEmail: () => void;
2913
+ linkPhone: () => void;
2914
+ linkWallet: () => void;
2915
+ linkGoogle: () => void;
2916
+ linkApple: () => void;
2917
+ linkTwitter: () => void;
2918
+ linkDiscord: () => void;
2919
+ linkGithub: () => void;
2920
+ linkLinkedIn: () => void;
2921
+ linkTiktok: () => void;
2922
+ linkSpotify: () => void;
2923
+ linkFarcaster: () => void;
2924
+ };
2925
+
2873
2926
  /**
2874
2927
  * Use this hook to connect the user's external wallet, and to attach
2875
2928
  * callbacks after a user succesfully connects their wallet, or if there
@@ -3077,4 +3130,4 @@ declare function addRpcUrlOverrideToChain(chain: Chain, rpcUrl: string): {
3077
3130
  testnet?: boolean | undefined;
3078
3131
  };
3079
3132
 
3080
- export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, Captcha, ConnectedWallet, ConnectorManager, ContractUIOptions, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, Farcaster, FarcasterWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, LinkedIn, LinkedInOAuthWithMetadata, LoginMethodOrderOption, LoginWithCode, MessageTypes, MfaMethod, MoonpayConfig, MoonpayCurrencyCode, MoonpayPaymentMethod, NonEmptyArray, OAuthProviderType, Phone, PhoneWithMetadata, PriceDisplayOptions, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, Tiktok, TiktokOAuthWithMetadata, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, TypedMessage, UnsignedTransactionRequest, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, WalletWithMetadata, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, useConnectWallet, useCreateWallet, useFundWallet, useLogin, useLoginWithEmail, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, usePrivy, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSignMessage, useSignTypedData, useToken, useWallets };
3133
+ export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, Captcha, ConnectedWallet, ConnectorManager, ContractUIOptions, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, Farcaster, FarcasterWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, LinkedIn, LinkedInOAuthWithMetadata, LoginMethodOrderOption, LoginWithCode, MessageTypes, MfaMethod, MoonpayConfig, MoonpayCurrencyCode, MoonpayPaymentMethod, NonEmptyArray, OAuthProviderType, Phone, PhoneWithMetadata, PriceDisplayOptions, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, Tiktok, TiktokOAuthWithMetadata, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, TypedMessage, UnsignedTransactionRequest, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, WalletWithMetadata, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, useConnectWallet, useCreateWallet, useFundWallet, useLinkAccount, useLogin, useLoginWithEmail, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, usePrivy, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSignMessage, useSignTypedData, useToken, useWallets };