@privy-io/react-auth 1.73.2 → 1.74.0

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
@@ -1267,7 +1267,7 @@ type OAuthProviderType = (typeof SUPPORTED_OAUTH_PROVIDERS)[number];
1267
1267
  * Supported OAuth providers for the recovery flow. Can be `'google-drive'`
1268
1268
  */
1269
1269
  type RecoveryProviderType = (typeof SUPPORTED_RECOVERY_PROVIDERS)[number];
1270
- type LoginMethod = 'email' | 'sms' | 'siwe' | 'farcaster' | OAuthProviderType | 'passkey' | 'telegram' | `privy:${string}`;
1270
+ type LoginMethod = 'email' | 'sms' | 'siwe' | 'farcaster' | OAuthProviderType | 'passkey' | 'telegram' | 'custom' | `privy:${string}`;
1271
1271
  type LoginWithCode = {
1272
1272
  /**
1273
1273
  * One-time password _([OTP](https://en.wikipedia.org/wiki/One-time_password))_ that was sent to user during first login step
@@ -2437,6 +2437,8 @@ interface PrivyProviderProps {
2437
2437
  /** Your Privy App Client ID, which can be retrieved from the Privy dashboard. */
2438
2438
  clientId?: string;
2439
2439
  /**
2440
+ * @deprecated. Use the `onSuccess` callback registered via the `useLogin` hook instead.
2441
+ *
2440
2442
  * An optional callback that will execute once a `login` call successfully completes.
2441
2443
  *
2442
2444
  * Within this callback, you can access:
@@ -3186,7 +3188,10 @@ declare function errorIndicatesMaxMfaRetries(error: unknown): error is PrivyIfra
3186
3188
 
3187
3189
  declare const VERSION: string;
3188
3190
 
3189
- type CallbackError = (error: PrivyErrorCode) => void;
3191
+ /**
3192
+ * `CallbackError` optionally includes a second parameter with further error details.
3193
+ */
3194
+ type CallbackError<Details extends Record<string, any> | undefined = undefined> = Details extends Record<string, any> ? (error: PrivyErrorCode, details: Details) => void : (error: PrivyErrorCode) => void;
3190
3195
  interface PrivyEvents {
3191
3196
  login: {
3192
3197
  /**
@@ -3276,9 +3281,12 @@ interface PrivyEvents {
3276
3281
  * Callback that will execute in the case of a non-successful account linking.
3277
3282
  *
3278
3283
  * @param error {PrivyErrorCode} - the corresponding error code
3284
+ * @param details.linkMethod {LoginMethod} - the type of (attempted) linked account
3279
3285
  *
3280
3286
  */
3281
- onError?: CallbackError;
3287
+ onError?: CallbackError<{
3288
+ linkMethod: LoginMethod;
3289
+ }>;
3282
3290
  };
3283
3291
  configureMfa: {
3284
3292
  /**
@@ -3378,8 +3386,12 @@ interface PrivyEvents {
3378
3386
  * if the refresh token is present and this field is undefined, it is assumed
3379
3387
  * that the refresh token does not have an expiration date.
3380
3388
  * @param oAuthTokens.scopes - {string[]} (optional) The list of OAuth scopes the access token is approved for.
3389
+ *
3390
+ * @param o.user {@link User} (optional) The list of OAuth scopes the access token is approved for.
3381
3391
  */
3382
- onOAuthTokenGrant: (oAuthTokens: OAuthTokens) => void;
3392
+ onOAuthTokenGrant: (oAuthTokens: OAuthTokens, o: {
3393
+ user: User;
3394
+ }) => void;
3383
3395
  };
3384
3396
  }
3385
3397