@privy-io/react-auth 1.81.2 → 1.81.3
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/chunk-XBTZ7LOU.js +118 -0
- package/dist/esm/chunk-XBTZ7LOU.js +118 -0
- package/dist/esm/index.js +316 -316
- package/dist/esm/ui.js +1 -1
- package/dist/index.d.ts +82 -5
- package/dist/index.js +306 -306
- package/dist/{types-afedc06b.d.ts → types-65e80fae.d.ts} +40 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +8 -8
- package/package.json +3 -3
- package/dist/chunk-M4HAID4L.js +0 -118
- package/dist/esm/chunk-M4HAID4L.js +0 -118
package/dist/esm/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$a as Q,G as K,Ma as R,Oa as u,Pa as Y,Wa as J,eb as q,fb as j,hb as f,kb as e1,nb as t1,ob as o1,pb as r1,w as $}from"./chunk-
|
|
1
|
+
import{$a as Q,G as K,Ma as R,Oa as u,Pa as Y,Wa as J,eb as q,fb as j,hb as f,kb as e1,nb as t1,ob as o1,pb as r1,w as $}from"./chunk-XBTZ7LOU.js";import{jsx as _,jsxs as n1}from"react/jsx-runtime";var i1=e=>n1("svg",{width:"44",height:"44",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[n1("g",{clipPath:"url(#clip0_57_8744)",children:[_("path",{d:"M15 21.6347C20.1355 21.6347 24.3 17.4714 24.3 12.3374C24.3 7.20348 20.1355 3.04016 15 3.04016C9.86455 3.04016 5.70001 7.20348 5.70001 12.3374C5.70001 17.4714 9.86455 21.6347 15 21.6347Z",fill:"currentColor"}),_("path",{d:"M15 27.0402C18.5098 27.0402 21.3556 26.4414 21.3556 25.7069C21.3556 24.9725 18.5117 24.3737 15 24.3737C11.4883 24.3737 8.64438 24.9725 8.64438 25.7069C8.64438 26.4414 11.4883 27.0402 15 27.0402Z",fill:"currentColor"})]}),_("defs",{children:_("clipPath",{id:"clip0_57_8744",children:_("rect",{width:"18.6",height:"24",fill:"currentColor",transform:"translate(5.70001 3.04016)"})})})]});import L2 from"styled-components";var E=L2.button`
|
|
2
2
|
--size: ${({size:e="44px"})=>e};
|
|
3
3
|
|
|
4
4
|
-webkit-font-smoothing: antialiased;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MouseEvent } from 'react';
|
|
3
|
-
import { C as Chain, B as BaseConnectedWallet, W as WalletClientType, R as RpcConfig, a as ConnectorType, P as PrivyProxyProvider, E as Embedded1193Provider, b as ConnectedWalletMetadata, c as WalletBranding, d as WalletListEntry, e as ExternalWalletsConfig, f as EIP1193Provider, U as User, O as OAuthTokens, g as OAuthProviderType, M as MoonpaySignRequest, h as MoonpaySignResponse, i as PrivyServerConfig, j as PrivyFarcasterSignerInitResponse, k as PrivyClientConfig, l as RuntimeLoginOverridableOptions, m as Wallet, S as SetWalletRecoveryOptions,
|
|
4
|
-
export {
|
|
3
|
+
import { C as Chain, B as BaseConnectedWallet, W as WalletClientType, R as RpcConfig, a as ConnectorType, P as PrivyProxyProvider, E as Embedded1193Provider, b as ConnectedWalletMetadata, c as WalletBranding, d as WalletListEntry, e as ExternalWalletsConfig, f as EIP1193Provider, U as User, O as OAuthTokens, g as OAuthProviderType, M as MoonpaySignRequest, h as MoonpaySignResponse, i as PrivyServerConfig, j as PrivyFarcasterSignerInitResponse, k as PrivyClientConfig, l as RuntimeLoginOverridableOptions, m as CreateWalletOptions, n as Wallet, S as SetWalletRecoveryOptions, o as SignMessageModalUIOptions, p as SignTypedDataParams, q as MfaMethod, r as UnsignedTransactionRequest, s as SendTransactionModalUIOptions, F as FundWalletConfig, T as TransactionReceipt, t as ConnectedWallet, u as PrivyIframeErrorTypesType, v as PrivyErrorCode, L as LoginMethod, w as LinkedAccountWithMetadata, x as UserRecoveryMethod, y as FundingMethod, z as LoginWithCode, A as OtpFlowState, D as ConnectedSolanaWallet, G as UnsignedTransactionRequestWithChainId, H as CustomAuthFlowState } from './types-65e80fae.js';
|
|
4
|
+
export { a6 as Apple, ag as AppleOAuthWithMetadata, I as AsExternalProvider, ao as ContractUIOptions, a9 as CrossAppAccount, aj as CrossAppAccountWithMetadata, a3 as Discord, ac as DiscordOAuthWithMetadata, al as Email, _ as EmailWithMetadata, as as Farcaster, ah as FarcasterWithMetadata, a4 as Github, ad as GithubOAuthWithMetadata, a1 as Google, aa as GoogleOAuthWithMetadata, a5 as LinkedIn, af as LinkedInOAuthWithMetadata, au as LoginMethodOrderOption, K as MessageTypes, N as MoonpayConfig, Q as MoonpayCurrencyCode, aq as MoonpayFundingConfig, V as MoonpayPaymentMethod, ap as NativeFundingConfig, Z as NonEmptyArray, at as Passkey, ak as PasskeyWithMetadata, am as Phone, $ as PhoneWithMetadata, ar as PriceDisplayOptions, X as Quantity, a8 as Telegram, ai as TelegramWithMetadata, a7 as Tiktok, ae as TiktokOAuthWithMetadata, Y as TransactionLog, an as TransactionUIOptions, a2 as Twitter, ab as TwitterOAuthWithMetadata, J as TypedMessage, a0 as WalletWithMetadata } from './types-65e80fae.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { TurnstileProps } from '@marsidev/react-turnstile';
|
|
7
7
|
import EventEmitter from 'eventemitter3';
|
|
@@ -126,6 +126,7 @@ interface BaseResponseWalletAccount {
|
|
|
126
126
|
* @deprecated Use `wallet_client_type` instead.
|
|
127
127
|
*/
|
|
128
128
|
wallet_client: 'privy' | 'unknown';
|
|
129
|
+
wallet_index: number | null;
|
|
129
130
|
wallet_client_type?: string;
|
|
130
131
|
connector_type?: string;
|
|
131
132
|
recovery_method?: 'privy' | 'user-passcode';
|
|
@@ -299,6 +300,7 @@ interface GetCurrentUserResponse {
|
|
|
299
300
|
refresh_token_expires_in_seconds?: number;
|
|
300
301
|
scopes?: string[];
|
|
301
302
|
};
|
|
303
|
+
custom_metadata?: Record<string, string>;
|
|
302
304
|
}
|
|
303
305
|
|
|
304
306
|
interface DefaultsType {
|
|
@@ -620,6 +622,12 @@ declare class PrivyClient {
|
|
|
620
622
|
walletClientType?: string;
|
|
621
623
|
connectorType?: string;
|
|
622
624
|
}): Promise<User>;
|
|
625
|
+
/**
|
|
626
|
+
* Method to update the custom metadata associated with an authenticated user.
|
|
627
|
+
*
|
|
628
|
+
* @returns The user object.
|
|
629
|
+
*/
|
|
630
|
+
setCustomMetadata(customMetadata: Record<string, string>): Promise<User>;
|
|
623
631
|
}
|
|
624
632
|
|
|
625
633
|
declare function getAccessToken(): Promise<string | null>;
|
|
@@ -1022,7 +1030,7 @@ interface PrivyInterface {
|
|
|
1022
1030
|
*
|
|
1023
1031
|
* @returns Promise for the {@link Wallet} object for the newly created embedded wallet
|
|
1024
1032
|
*/
|
|
1025
|
-
createWallet: () => Promise<Wallet>;
|
|
1033
|
+
createWallet: (options?: CreateWalletOptions | MouseEvent<any, any>) => Promise<Wallet>;
|
|
1026
1034
|
/**
|
|
1027
1035
|
* @deprecated. Use `setWalletRecovery` instead.
|
|
1028
1036
|
*
|
|
@@ -1613,6 +1621,32 @@ interface PrivyEvents {
|
|
|
1613
1621
|
balance: bigint | undefined;
|
|
1614
1622
|
}) => void;
|
|
1615
1623
|
};
|
|
1624
|
+
setCustomMetadata: {
|
|
1625
|
+
/**
|
|
1626
|
+
* Callback that will execute once a successful `setCustomMetadata` completes.
|
|
1627
|
+
* @param user - the the user with updated customMetadata
|
|
1628
|
+
*/
|
|
1629
|
+
onSuccess?: (user: User) => void;
|
|
1630
|
+
/**
|
|
1631
|
+
* Callback that will execute in the case of a non-successful setCustomMetadata.
|
|
1632
|
+
*
|
|
1633
|
+
* @param error {@link PrivyErrorCode} - the corresponding error code
|
|
1634
|
+
* */
|
|
1635
|
+
onError?: CallbackError;
|
|
1636
|
+
};
|
|
1637
|
+
customAuth: {
|
|
1638
|
+
/**
|
|
1639
|
+
* Callback that will execute when Privy successfully exchanges a custom auth JWT for a Privy JWT
|
|
1640
|
+
* @param o.user - The Privy user
|
|
1641
|
+
*/
|
|
1642
|
+
onAuthenticated: (o: {
|
|
1643
|
+
user: User;
|
|
1644
|
+
}) => void;
|
|
1645
|
+
/**
|
|
1646
|
+
* Callback that will execute when Privy detects a user is logged out from the third-party auth system, and correspondingly logs the user out.
|
|
1647
|
+
*/
|
|
1648
|
+
onUnauthenticated: () => void;
|
|
1649
|
+
};
|
|
1616
1650
|
}
|
|
1617
1651
|
|
|
1618
1652
|
/**
|
|
@@ -1933,7 +1967,7 @@ declare function useCreateWallet(callbacks?: PrivyEvents['createWallet']): {
|
|
|
1933
1967
|
*
|
|
1934
1968
|
* @returns Promise for the {@link Wallet} object for the newly created embedded wallet
|
|
1935
1969
|
*/
|
|
1936
|
-
createWallet: () => Promise<Wallet>;
|
|
1970
|
+
createWallet: (options?: CreateWalletOptions | react.MouseEvent<any, any>) => Promise<Wallet>;
|
|
1937
1971
|
};
|
|
1938
1972
|
|
|
1939
1973
|
/**
|
|
@@ -2212,6 +2246,28 @@ type UseOAuthTokens = {
|
|
|
2212
2246
|
*/
|
|
2213
2247
|
declare function useOAuthTokens(callbacks?: PrivyEvents['oAuthAuthorization']): UseOAuthTokens;
|
|
2214
2248
|
|
|
2249
|
+
type UseCustomAuth = {
|
|
2250
|
+
/**
|
|
2251
|
+
* Object that indicates the status of Privy's custom auth flow.
|
|
2252
|
+
*
|
|
2253
|
+
* Possible values include: {
|
|
2254
|
+
* status: 'initial' | 'loading' | 'not-enabled' | 'done';
|
|
2255
|
+
* }
|
|
2256
|
+
* or {
|
|
2257
|
+
* status: 'error';
|
|
2258
|
+
* error: Error | null;
|
|
2259
|
+
* }
|
|
2260
|
+
*
|
|
2261
|
+
*/
|
|
2262
|
+
status: CustomAuthFlowState;
|
|
2263
|
+
};
|
|
2264
|
+
/**
|
|
2265
|
+
* Use this hook to check the Privy auth flow status for whenever third-party/custom auth is enabled.
|
|
2266
|
+
*
|
|
2267
|
+
* @returns status - auth flow/ JWT exchange status of the Privy user, if custom auth is enabled
|
|
2268
|
+
*/
|
|
2269
|
+
declare const useCustomAuth: (callbacks?: PrivyEvents["customAuth"]) => UseCustomAuth;
|
|
2270
|
+
|
|
2215
2271
|
/**
|
|
2216
2272
|
* @deprecated Use `useFarcasterSigner` instead.
|
|
2217
2273
|
*/
|
|
@@ -2227,6 +2283,27 @@ declare function useFarcasterSigner(): {
|
|
|
2227
2283
|
requestFarcasterSignerFromWarpcast: () => Promise<void>;
|
|
2228
2284
|
};
|
|
2229
2285
|
|
|
2286
|
+
type UseSetCustomMetadata = {
|
|
2287
|
+
/**
|
|
2288
|
+
* Method that allows a user to set the custom metadata value for their account. Fails if the input byte size is >1KB.
|
|
2289
|
+
*
|
|
2290
|
+
* @param customMetadata - JSON object of key-value string pairs to input as a user's customMetadata field.
|
|
2291
|
+
* @returns - The user object with the updated customMetadata value.
|
|
2292
|
+
*
|
|
2293
|
+
*/
|
|
2294
|
+
setCustomMetadata: <CustomMetadataInput extends Record<string, string>>(customMetadata: CustomMetadataInput) => Promise<User>;
|
|
2295
|
+
};
|
|
2296
|
+
/**
|
|
2297
|
+
* Use this hook to set custon metadata on the user object, and to attach callbacks
|
|
2298
|
+
* for successful `metadata set`s, and `metadata set` errors.
|
|
2299
|
+
*
|
|
2300
|
+
* @param callbacks.onSuccess {@link PrivyEvents} callback to execute for a successful metadata setting
|
|
2301
|
+
* @param callbacks.onError {@link PrivyEvents} callback to execute if there is an error during `setCustomMetadata` -- ie.
|
|
2302
|
+
* if the custom metadata input is too large (>1KB)
|
|
2303
|
+
* @returns setCustomMetadata - makes a request to the Privy API to update user.customMetadata with the given input JSON
|
|
2304
|
+
*/
|
|
2305
|
+
declare function useSetCustomMetadata(callbacks?: PrivyEvents['setCustomMetadata']): UseSetCustomMetadata;
|
|
2306
|
+
|
|
2230
2307
|
/**
|
|
2231
2308
|
* Allows you to override the RPC url for the given chain
|
|
2232
2309
|
*
|
|
@@ -2294,4 +2371,4 @@ declare const LoginModal: ({ open }: {
|
|
|
2294
2371
|
open: boolean;
|
|
2295
2372
|
}) => react_jsx_runtime.JSX.Element;
|
|
2296
2373
|
|
|
2297
|
-
export { CallbackError, Captcha, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, EIP1193Provider, FundWalletConfig, LoginModal, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseSolanaWalletsInterface, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useSolanaWallets, useToken, useWallets };
|
|
2374
|
+
export { CallbackError, Captcha, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, FundWalletConfig, LoginModal, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseCustomAuth, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseSetCustomMetadata, UseSolanaWalletsInterface, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendTransaction, useSetCustomMetadata, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useSolanaWallets, useToken, useWallets };
|