@privy-io/react-auth 1.30.4 → 1.31.0-beta.1
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/esm/index.js +157 -157
- package/dist/index.d.ts +77 -1
- package/dist/index.js +157 -157
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -177,6 +177,13 @@ declare enum PrivyErrorCode {
|
|
|
177
177
|
INVALID_DATA = "invalid_data",
|
|
178
178
|
LINKED_TO_ANOTHER_USER = "linked_to_another_user",
|
|
179
179
|
ALLOWLIST_REJECTED = "allowlist_rejected",
|
|
180
|
+
OAUTH_INVALID_AUTH_CODE = "oauth_invalid_auth_code",
|
|
181
|
+
OAUTH_USER_DENIED = "oauth_user_denied",
|
|
182
|
+
UNKNOWN_AUTH_ERROR = "unknown_auth_error",
|
|
183
|
+
USER_EXITED_AUTH_FLOW = "exited_auth_flow",
|
|
184
|
+
MUST_BE_AUTHENTICATED = "must_be_authenticated",
|
|
185
|
+
UNKNOWN_CONNECT_WALLET_ERROR = "unknown_connect_wallet_error",
|
|
186
|
+
GENERIC_CONNECT_WALLET_ERROR = "generic_connect_wallet_error",
|
|
180
187
|
CLIENT_REQUEST_TIMEOUT = "client_request_timeout"
|
|
181
188
|
}
|
|
182
189
|
|
|
@@ -1386,4 +1393,73 @@ declare class PrivyClient {
|
|
|
1386
1393
|
forkSession(): Promise<string>;
|
|
1387
1394
|
}
|
|
1388
1395
|
|
|
1389
|
-
|
|
1396
|
+
type CallbackError = (error: PrivyErrorCode) => void;
|
|
1397
|
+
type PrivyEvents = {
|
|
1398
|
+
login: {
|
|
1399
|
+
/**
|
|
1400
|
+
* Callback that will execute once a `login` flow successfully completes.
|
|
1401
|
+
* - If `config.embeddedWallets.createOnLogin` is set to 'off' or a wallet creation flow is not applicable,
|
|
1402
|
+
* this will run after the user successfully authenticates.
|
|
1403
|
+
* - If `config.embeddedWallets.createOnLogin` is set to 'users-without-wallets' or 'all-users',
|
|
1404
|
+
* this will run after the user successfully authenticates _and_ creates their wallet (if applicable).
|
|
1405
|
+
*
|
|
1406
|
+
* @param user {User} - the `user` oject corresponding to the authenticated user
|
|
1407
|
+
* @param isNewUser {boolean} - boolean flag indicating if this is the user's first time logging in to your app
|
|
1408
|
+
*
|
|
1409
|
+
*/
|
|
1410
|
+
onSuccess?: (user: User, isNewUser: boolean) => void;
|
|
1411
|
+
/**
|
|
1412
|
+
* Callback that will execute in the case of a non-successful login.
|
|
1413
|
+
*
|
|
1414
|
+
* @param error {PrivyErrorCode} - the corresponding error code
|
|
1415
|
+
*
|
|
1416
|
+
*/
|
|
1417
|
+
onError?: CallbackError;
|
|
1418
|
+
};
|
|
1419
|
+
logout: {
|
|
1420
|
+
/**
|
|
1421
|
+
* Callback that will execute when a user successfully logs out.
|
|
1422
|
+
*/
|
|
1423
|
+
onSuccess?: () => void;
|
|
1424
|
+
};
|
|
1425
|
+
connectWallet: {
|
|
1426
|
+
/**
|
|
1427
|
+
* Callback that will execute once a successful `connectWallet` completes.
|
|
1428
|
+
* This will not run in the case of a wallet-based authentication flow.
|
|
1429
|
+
*
|
|
1430
|
+
* @param wallet {BaseConnectedWallet}- the `wallet` object correspending to the connection
|
|
1431
|
+
*
|
|
1432
|
+
*/
|
|
1433
|
+
onSuccess?: (wallet: BaseConnectedWallet) => void;
|
|
1434
|
+
/**
|
|
1435
|
+
* Callback that will execute in the case of a non-successful wallet connection.
|
|
1436
|
+
*
|
|
1437
|
+
* @param error {PrivyErrorCode} - the corresponding error code
|
|
1438
|
+
*
|
|
1439
|
+
*/
|
|
1440
|
+
onError?: CallbackError;
|
|
1441
|
+
};
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
declare function useLogin(callbacks?: PrivyEvents['login']): {
|
|
1445
|
+
/**
|
|
1446
|
+
* Opens the Privy login modal and prompts the user to login.
|
|
1447
|
+
*/
|
|
1448
|
+
login: () => void;
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
declare function useLogout(callbacks?: PrivyEvents['logout']): {
|
|
1452
|
+
/**
|
|
1453
|
+
* Log the current user out and clears their authentication state. `authenticated` will become false, `user` will become null, and the Privy Auth tokens will be deleted from the browser's local storage.
|
|
1454
|
+
*/
|
|
1455
|
+
logout: () => Promise<void>;
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
declare function useConnectWallet(callbacks?: PrivyEvents['connectWallet']): {
|
|
1459
|
+
/**
|
|
1460
|
+
* Opens the Privy modal and prompts the user to connect a wallet.
|
|
1461
|
+
*/
|
|
1462
|
+
connectWallet: () => void;
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
export { Apple, AppleOAuthWithMetadata, AsExternalProvider, ConnectedWallet, ConnectorManager, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, SendTransactionModalUIOptions, SignMessageModalUIOptions, TransactionLog, TransactionReceipt, Twitter, TwitterOAuthWithMetadata, UnsignedTransactionRequest, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, useConnectWallet, useLogin, useLogout, usePrivy, useWallets };
|