@magic-ext/magic-widget 1.0.0-canary.979.21086297627.0 → 1.0.0-canary.979.21261294144.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.
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { MagicWidgetProps } from './types';
3
- export declare function MagicWidget({ displayMode, isOpen, onClose, closeOnSuccess, closeOnClickOutside, wallets, onSuccess, onError, }: MagicWidgetProps): React.JSX.Element | null;
3
+ export declare function MagicWidget({ displayMode, isOpen, onClose, closeOnSuccess, closeOnClickOutside, wallets, onSuccess, onError, onReady, }: MagicWidgetProps): React.JSX.Element | null;
@@ -1,10 +1,11 @@
1
1
  import { LoginProvider, OAuthProvider, ThirdPartyWallet } from './types';
2
- export type View = 'login' | 'otp' | 'additional_providers' | 'wallet_pending' | 'oauth_pending' | 'email_otp_pending' | 'device_verification' | 'mfa_pending' | 'recovery_code' | 'lost_recovery_code' | 'login_success';
2
+ export type View = 'login' | 'otp' | 'additional_providers' | 'wallet_pending' | 'walletconnect_pending' | 'oauth_pending' | 'email_otp_pending' | 'device_verification' | 'mfa_pending' | 'recovery_code' | 'lost_recovery_code' | 'login_success';
3
3
  export type EmailLoginStatus = 'idle' | 'sending' | 'otp_sent' | 'verifying_otp' | 'invalid_otp' | 'expired_otp' | 'max_attempts_reached' | 'device_needs_approval' | 'device_verification_sent' | 'device_verification_expired' | 'device_approved' | 'mfa_required' | 'recovery_code' | 'success' | 'mfa_verifying' | 'mfa_invalid' | 'recovery_code_verifying' | 'lost_recovery_code' | 'error';
4
4
  export interface WidgetState {
5
5
  view: View;
6
6
  email?: string;
7
7
  selectedProvider?: LoginProvider;
8
+ walletAddress?: string;
8
9
  error?: string;
9
10
  emailLoginStatus?: EmailLoginStatus;
10
11
  }
@@ -60,6 +61,9 @@ export type WidgetAction = {
60
61
  } | {
61
62
  type: 'SELECT_WALLET';
62
63
  provider: ThirdPartyWallet;
64
+ } | {
65
+ type: 'WALLETCONNECT_CONNECTED';
66
+ address: string;
63
67
  };
64
68
  export declare const initialState: WidgetState;
65
69
  export declare function widgetReducer(state: WidgetState, action: WidgetAction): WidgetState;
@@ -6,7 +6,10 @@ export interface ClientTheme {
6
6
  buttonRadius: string | undefined;
7
7
  containerRadius: string | undefined;
8
8
  backgroundColor: `#${string}` | undefined;
9
+ neutralColor: `#${string}` | undefined;
9
10
  themeColor: 'auto' | 'dark' | 'light';
11
+ customBrandingType: 1 | 2;
12
+ isDefaultAsset?: boolean;
10
13
  }
11
14
  export interface ClientConfig {
12
15
  clientId: string;
@@ -1,4 +1,5 @@
1
1
  import { ComponentType } from 'react';
2
+ import { OAuthRedirectResult } from './extension';
2
3
  /**
3
4
  * Available third-party wallet providers.
4
5
  * Use these constants or pass string literals directly: 'metamask', 'coinbase', etc.
@@ -72,10 +73,10 @@ export interface EmailLoginResult {
72
73
  */
73
74
  export interface OAuthLoginResult {
74
75
  method: 'oauth';
75
- /** The DID token for authentication */
76
- didToken: string;
77
76
  /** OAuth provider information */
78
- oauth: OAuthUserInfo;
77
+ oauth: OAuthRedirectResult['oauth'];
78
+ /** Magic user metadata */
79
+ magic: OAuthRedirectResult['magic'];
79
80
  }
80
81
  /**
81
82
  * Result returned on successful wallet login
@@ -158,4 +159,10 @@ export interface MagicWidgetProps {
158
159
  * @example onError={(error) => console.error(error.message)}
159
160
  */
160
161
  onError?: (error: Error) => void;
162
+ /**
163
+ * Callback fired when the widget has finished initializing and is ready to display.
164
+ * Use this to hide your custom loading UI.
165
+ * @example onReady={() => setIsLoading(false)}
166
+ */
167
+ onReady?: () => void;
161
168
  }
@@ -0,0 +1,5 @@
1
+ export declare function isAndroid(): boolean;
2
+ export declare function isSmallIOS(): boolean;
3
+ export declare function isLargeIOS(): boolean;
4
+ export declare function isIOS(): boolean;
5
+ export declare function isMobile(): boolean;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { WidgetAction } from '../reducer';
3
+ interface WalletConnectViewProps {
4
+ dispatch: React.Dispatch<WidgetAction>;
5
+ }
6
+ export declare const WalletConnectView: ({ dispatch }: WalletConnectViewProps) => React.JSX.Element;
7
+ 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 { ThirdPartyWallet } from '../types';
4
4
  interface WalletPendingViewProps {
5
5
  provider: ThirdPartyWallet;
6
+ state: WidgetState;
6
7
  dispatch: React.Dispatch<WidgetAction>;
7
8
  }
8
- export declare const WalletPendingView: ({ provider, dispatch }: WalletPendingViewProps) => React.JSX.Element;
9
+ export declare const WalletPendingView: ({ provider, state, dispatch }: WalletPendingViewProps) => React.JSX.Element | null;
9
10
  export {};
@@ -0,0 +1,3 @@
1
+ import type { EthereumProvider } from '@walletconnect/ethereum-provider';
2
+ export declare function setWalletConnectProvider(provider: Awaited<ReturnType<typeof EthereumProvider.init>> | null): void;
3
+ export declare function getWalletConnectProvider(): Awaited<ReturnType<typeof EthereumProvider.init>> | null;