@magic-ext/wallet-kit 0.4.1 → 0.4.2-canary.1035.22165603003.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.
@@ -0,0 +1,18 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { WidgetAction } from '../reducer';
3
+ import { OAuthProvider } from '../extension';
4
+ interface OAuthLoginContextValue {
5
+ startOAuthLogin: (provider: OAuthProvider) => void;
6
+ submitMFA: (totp: string) => void;
7
+ lostDevice: () => void;
8
+ submitRecoveryCode: (recoveryCode: string) => void;
9
+ cancelLogin: () => void;
10
+ isMfaActive: boolean;
11
+ }
12
+ interface OAuthLoginProviderProps {
13
+ children: ReactNode;
14
+ dispatch: React.Dispatch<WidgetAction>;
15
+ }
16
+ export declare function OAuthLoginProvider({ children, dispatch }: OAuthLoginProviderProps): React.JSX.Element;
17
+ export declare function useOAuthLogin(): OAuthLoginContextValue;
18
+ export {};
@@ -1,2 +1,3 @@
1
1
  export { EmailLoginProvider, useEmailLogin } from './EmailLoginContext';
2
+ export { OAuthLoginProvider, useOAuthLogin } from './OAuthLoginContext';
2
3
  export { WidgetConfigProvider, useWidgetConfig } from './WidgetConfigContext';
@@ -183,9 +183,31 @@ export declare class WalletKitExtension extends Extension.Internal<'walletKit'>
183
183
  login(params: SiweLoginParams): Promise<string>;
184
184
  /**
185
185
  * Login with OAuth popup.
186
- * Opens a popup for the specified OAuth provider and returns the result.
186
+ * Opens a popup for the specified OAuth provider and returns a PromiEvent handle.
187
+ * The handle emits MFA events when the user has MFA enabled.
187
188
  */
188
- loginWithPopup(provider: OAuthProvider): Promise<OAuthRedirectResult>;
189
+ loginWithPopup(provider: OAuthProvider): import("@magic-sdk/provider").PromiEvent<OAuthRedirectResult, {
190
+ "popup-event": (eventData: unknown) => void;
191
+ "popup-url": (event: {
192
+ popupUrl: string;
193
+ provider: string;
194
+ }) => void;
195
+ } & {
196
+ cancel: () => void;
197
+ "verify-mfa-code": (mfa: string) => void;
198
+ "lost-device": () => void;
199
+ "verify-recovery-code": (recoveryCode: string) => void;
200
+ "mfa-sent-handle": () => void;
201
+ "invalid-mfa-otp": () => void;
202
+ "recovery-code-sent-handle": () => void;
203
+ "invalid-recovery-code": () => void;
204
+ "recovery-code-success": () => void;
205
+ } & {
206
+ done: (result: OAuthRedirectResult) => void;
207
+ error: (reason: any) => void;
208
+ settled: () => void;
209
+ "closed-by-user": () => void;
210
+ }>;
189
211
  /**
190
212
  * Fetch client configuration via RPC (proxied through embedded-wallet iframe).
191
213
  * This avoids CORS issues by having the iframe make the request.
@@ -0,0 +1,8 @@
1
+ interface UseMfaResult {
2
+ submitMFA: (totp: string) => void;
3
+ lostDevice: () => void;
4
+ submitRecoveryCode: (recoveryCode: string) => void;
5
+ cancelLogin: () => void;
6
+ }
7
+ export declare function useMfa(): UseMfaResult;
8
+ export {};
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { WidgetAction } from '../reducer';
2
+ import { WidgetAction, WidgetState } from '../reducer';
3
3
  import { OAuthProvider } from '../types';
4
4
  interface OAuthPendingViewProps {
5
5
  provider: OAuthProvider;
6
+ state: WidgetState;
6
7
  dispatch: React.Dispatch<WidgetAction>;
7
8
  }
8
- export declare const OAuthPendingView: ({ provider, dispatch }: OAuthPendingViewProps) => React.JSX.Element;
9
+ export declare const OAuthPendingView: ({ provider, state, dispatch }: OAuthPendingViewProps) => React.JSX.Element;
9
10
  export {};
@@ -0,0 +1,18 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { WidgetAction } from '../reducer';
3
+ import { OAuthProvider } from '../extension';
4
+ interface OAuthLoginContextValue {
5
+ startOAuthLogin: (provider: OAuthProvider) => void;
6
+ submitMFA: (totp: string) => void;
7
+ lostDevice: () => void;
8
+ submitRecoveryCode: (recoveryCode: string) => void;
9
+ cancelLogin: () => void;
10
+ isMfaActive: boolean;
11
+ }
12
+ interface OAuthLoginProviderProps {
13
+ children: ReactNode;
14
+ dispatch: React.Dispatch<WidgetAction>;
15
+ }
16
+ export declare function OAuthLoginProvider({ children, dispatch }: OAuthLoginProviderProps): React.JSX.Element;
17
+ export declare function useOAuthLogin(): OAuthLoginContextValue;
18
+ export {};
@@ -1,2 +1,3 @@
1
1
  export { EmailLoginProvider, useEmailLogin } from './EmailLoginContext';
2
+ export { OAuthLoginProvider, useOAuthLogin } from './OAuthLoginContext';
2
3
  export { WidgetConfigProvider, useWidgetConfig } from './WidgetConfigContext';
@@ -183,9 +183,31 @@ export declare class WalletKitExtension extends Extension.Internal<'walletKit'>
183
183
  login(params: SiweLoginParams): Promise<string>;
184
184
  /**
185
185
  * Login with OAuth popup.
186
- * Opens a popup for the specified OAuth provider and returns the result.
186
+ * Opens a popup for the specified OAuth provider and returns a PromiEvent handle.
187
+ * The handle emits MFA events when the user has MFA enabled.
187
188
  */
188
- loginWithPopup(provider: OAuthProvider): Promise<OAuthRedirectResult>;
189
+ loginWithPopup(provider: OAuthProvider): import("@magic-sdk/provider").PromiEvent<OAuthRedirectResult, {
190
+ "popup-event": (eventData: unknown) => void;
191
+ "popup-url": (event: {
192
+ popupUrl: string;
193
+ provider: string;
194
+ }) => void;
195
+ } & {
196
+ cancel: () => void;
197
+ "verify-mfa-code": (mfa: string) => void;
198
+ "lost-device": () => void;
199
+ "verify-recovery-code": (recoveryCode: string) => void;
200
+ "mfa-sent-handle": () => void;
201
+ "invalid-mfa-otp": () => void;
202
+ "recovery-code-sent-handle": () => void;
203
+ "invalid-recovery-code": () => void;
204
+ "recovery-code-success": () => void;
205
+ } & {
206
+ done: (result: OAuthRedirectResult) => void;
207
+ error: (reason: any) => void;
208
+ settled: () => void;
209
+ "closed-by-user": () => void;
210
+ }>;
189
211
  /**
190
212
  * Fetch client configuration via RPC (proxied through embedded-wallet iframe).
191
213
  * This avoids CORS issues by having the iframe make the request.
@@ -0,0 +1,8 @@
1
+ interface UseMfaResult {
2
+ submitMFA: (totp: string) => void;
3
+ lostDevice: () => void;
4
+ submitRecoveryCode: (recoveryCode: string) => void;
5
+ cancelLogin: () => void;
6
+ }
7
+ export declare function useMfa(): UseMfaResult;
8
+ export {};
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { WidgetAction } from '../reducer';
2
+ import { WidgetAction, WidgetState } from '../reducer';
3
3
  import { OAuthProvider } from '../types';
4
4
  interface OAuthPendingViewProps {
5
5
  provider: OAuthProvider;
6
+ state: WidgetState;
6
7
  dispatch: React.Dispatch<WidgetAction>;
7
8
  }
8
- export declare const OAuthPendingView: ({ provider, dispatch }: OAuthPendingViewProps) => React.JSX.Element;
9
+ export declare const OAuthPendingView: ({ provider, state, dispatch }: OAuthPendingViewProps) => React.JSX.Element;
9
10
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magic-ext/wallet-kit",
3
3
  "useCustomBuild": true,
4
- "version": "0.4.1",
4
+ "version": "0.4.2-canary.1035.22165603003.0",
5
5
  "description": "Magic SDK Wallet Kit Extension",
6
6
  "author": "Magic <team@magic.link> (https://magic.link/)",
7
7
  "license": "MIT",
@@ -62,8 +62,8 @@
62
62
  "viem": "^2.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@magic-sdk/provider": "^33.4.1",
66
- "@magic-sdk/types": "^27.4.0",
65
+ "@magic-sdk/provider": "33.4.2-canary.1035.22165603003.0",
66
+ "@magic-sdk/types": "27.4.1-canary.1035.22165603003.0",
67
67
  "@pandacss/dev": "^0.35.0",
68
68
  "@rollup/plugin-commonjs": "^26.0.1",
69
69
  "@rollup/plugin-node-resolve": "^15.2.3",
@@ -79,5 +79,5 @@
79
79
  "tslib": "^2.6.3",
80
80
  "viem": "^2.37.9"
81
81
  },
82
- "gitHead": "6e093d624a0848be10c027dadda30e15fa36cf56"
82
+ "gitHead": "e905824fe168cef602ef2a079867c3b32c07271e"
83
83
  }
@@ -1,9 +0,0 @@
1
- import { OAuthProvider, OAuthRedirectResult } from '../extension';
2
- export interface UseOAuthLoginResult {
3
- performOAuthLogin: (provider: OAuthProvider) => Promise<OAuthRedirectResult>;
4
- isLoading: boolean;
5
- error: Error | null;
6
- isSuccess: boolean;
7
- result: OAuthRedirectResult | null;
8
- }
9
- export declare function useOAuthLogin(): UseOAuthLoginResult;
@@ -1,9 +0,0 @@
1
- import { OAuthProvider, OAuthRedirectResult } from '../extension';
2
- export interface UseOAuthLoginResult {
3
- performOAuthLogin: (provider: OAuthProvider) => Promise<OAuthRedirectResult>;
4
- isLoading: boolean;
5
- error: Error | null;
6
- isSuccess: boolean;
7
- result: OAuthRedirectResult | null;
8
- }
9
- export declare function useOAuthLogin(): UseOAuthLoginResult;