@web3auth/modal 10.8.3 → 10.9.0-alpha.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.
Files changed (101) hide show
  1. package/dist/lib.cjs/packages/modal/src/config.js +1 -1
  2. package/dist/lib.cjs/packages/modal/src/modalManager.js +22 -6
  3. package/dist/lib.cjs/packages/modal/src/react/context/WalletServicesInnerContext.js +1 -1
  4. package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
  5. package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
  6. package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
  7. package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
  8. package/dist/lib.cjs/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +88 -0
  9. package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +2 -11
  10. package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
  11. package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +6 -5
  12. package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +67 -5
  13. package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +8 -2
  14. package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +18 -5
  15. package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
  16. package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +3 -0
  17. package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +3 -0
  18. package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +3 -0
  19. package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +3 -0
  20. package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +3 -0
  21. package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
  22. package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
  23. package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +3 -0
  24. package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +3 -0
  25. package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +3 -1
  26. package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +26 -2
  27. package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +13 -3
  28. package/dist/lib.cjs/packages/modal/src/vue/composables/useCheckout.js +1 -0
  29. package/dist/lib.cjs/packages/modal/src/vue/composables/useEnableMFA.js +1 -0
  30. package/dist/lib.cjs/packages/modal/src/vue/composables/useFunding.js +1 -0
  31. package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +10 -3
  32. package/dist/lib.cjs/packages/modal/src/vue/composables/useManageMFA.js +1 -0
  33. package/dist/lib.cjs/packages/modal/src/vue/composables/useReceive.js +1 -0
  34. package/dist/lib.cjs/packages/modal/src/vue/composables/useSwap.js +1 -0
  35. package/dist/lib.cjs/packages/modal/src/vue/composables/useSwitchChain.js +1 -0
  36. package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletConnectScanner.js +1 -0
  37. package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletUI.js +1 -0
  38. package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthConnect.js +2 -0
  39. package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +1 -0
  40. package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthUser.js +1 -0
  41. package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +1 -0
  42. package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignMessage.js +1 -0
  43. package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignTransaction.js +1 -0
  44. package/dist/lib.cjs/types/modalManager.d.ts +1 -0
  45. package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.d.ts +1 -1
  46. package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.type.d.ts +2 -0
  47. package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.d.ts +3 -0
  48. package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.type.d.ts +19 -0
  49. package/dist/lib.cjs/types/ui/components/CircularLoader/index.d.ts +2 -0
  50. package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.type.d.ts +0 -1
  51. package/dist/lib.cjs/types/ui/components/Loader/Loader.type.d.ts +8 -0
  52. package/dist/lib.cjs/types/ui/components/Root/Root.type.d.ts +5 -1
  53. package/dist/lib.cjs/types/ui/components/Widget/Widget.type.d.ts +5 -1
  54. package/dist/lib.cjs/types/ui/interfaces.d.ts +7 -1
  55. package/dist/lib.cjs/types/ui/loginModal.d.ts +1 -0
  56. package/dist/lib.cjs/types/vue/interfaces.d.ts +1 -0
  57. package/dist/lib.esm/packages/modal/src/config.js +1 -1
  58. package/dist/lib.esm/packages/modal/src/modalManager.js +23 -7
  59. package/dist/lib.esm/packages/modal/src/react/context/WalletServicesInnerContext.js +2 -2
  60. package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
  61. package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
  62. package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
  63. package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
  64. package/dist/lib.esm/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +86 -0
  65. package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +3 -13
  66. package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
  67. package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +6 -5
  68. package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +68 -6
  69. package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +8 -2
  70. package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +19 -6
  71. package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
  72. package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +3 -0
  73. package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +3 -0
  74. package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +3 -0
  75. package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +3 -0
  76. package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +3 -0
  77. package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
  78. package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
  79. package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +3 -0
  80. package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +3 -0
  81. package/dist/lib.esm/packages/modal/src/ui/interfaces.js +3 -1
  82. package/dist/lib.esm/packages/modal/src/ui/loginModal.js +28 -4
  83. package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +14 -4
  84. package/dist/lib.esm/packages/modal/src/vue/composables/useCheckout.js +2 -1
  85. package/dist/lib.esm/packages/modal/src/vue/composables/useEnableMFA.js +2 -1
  86. package/dist/lib.esm/packages/modal/src/vue/composables/useFunding.js +2 -1
  87. package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +11 -4
  88. package/dist/lib.esm/packages/modal/src/vue/composables/useManageMFA.js +2 -1
  89. package/dist/lib.esm/packages/modal/src/vue/composables/useReceive.js +2 -1
  90. package/dist/lib.esm/packages/modal/src/vue/composables/useSwap.js +2 -1
  91. package/dist/lib.esm/packages/modal/src/vue/composables/useSwitchChain.js +2 -1
  92. package/dist/lib.esm/packages/modal/src/vue/composables/useWalletConnectScanner.js +2 -1
  93. package/dist/lib.esm/packages/modal/src/vue/composables/useWalletUI.js +2 -1
  94. package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthConnect.js +3 -1
  95. package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +2 -1
  96. package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthUser.js +2 -1
  97. package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +2 -1
  98. package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignMessage.js +2 -1
  99. package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignTransaction.js +2 -1
  100. package/dist/modal.umd.min.js +1 -1
  101. package/package.json +3 -3
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from "react";
2
+ export interface CircularLoaderProps {
3
+ width?: number | string;
4
+ height?: number | string;
5
+ thickness?: number;
6
+ showChildren?: boolean;
7
+ children?: ReactNode;
8
+ className?: string;
9
+ trackColor?: string;
10
+ /** Size of the colored arc in degrees (0-360). Default: 40 */
11
+ arcSizeDeg?: number;
12
+ /** Two colors for the orange arc gradient [start, end]. */
13
+ arcColors?: [string, string];
14
+ /**
15
+ * CSS color stops for conic-gradient. Example:
16
+ * "conic-gradient(#f97316, #fdba74 320deg, transparent 320deg)"
17
+ */
18
+ gradient?: string;
19
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from "./CircularLoader";
2
+ export type { CircularLoaderProps } from "./CircularLoader.type";
@@ -14,7 +14,6 @@ export interface ConnectWalletListProps {
14
14
  buttonRadius: ButtonRadiusType;
15
15
  handleWalletClick: (button: ExternalButton) => void;
16
16
  handleMoreWallets: () => void;
17
- isShowAllWallets: boolean;
18
17
  }
19
18
  export type WalletsFoundProps = Pick<ConnectWalletListProps, "externalButtons" | "isLoading" | "handleWalletClick" | "deviceDetails" | "walletConnectUri" | "buttonRadius">;
20
19
  export type MoreWalletsButtonProps = Pick<ConnectWalletListProps, "totalExternalWalletsCount" | "initialWalletCount" | "handleMoreWallets" | "isLoading" | "isDark" | "buttonRadius">;
@@ -1,12 +1,20 @@
1
+ import { BaseConnectorConfig, WALLET_CONNECTOR_TYPE, WalletRegistry } from "@web3auth/no-modal";
1
2
  import type { ModalStatusType } from "../../interfaces";
2
3
  export interface LoaderProps {
4
+ externalWalletsConfig: Record<string, BaseConnectorConfig>;
5
+ walletRegistry?: WalletRegistry;
3
6
  message?: string;
4
7
  appLogo?: string;
5
8
  connector: string;
6
9
  connectorName: string;
7
10
  modalStatus: ModalStatusType;
8
11
  onClose: () => void;
12
+ isConnectAndSignAuthenticationMode: boolean;
13
+ handleMobileVerifyConnect: (params: {
14
+ connector: WALLET_CONNECTOR_TYPE;
15
+ }) => void;
9
16
  }
10
17
  export type ConnectingStatusType = Pick<LoaderProps, "connectorName" | "appLogo" | "connector">;
11
18
  export type ConnectedStatusType = Pick<LoaderProps, "message">;
12
19
  export type ErroredStatusType = Pick<LoaderProps, "message">;
20
+ export type AuthorizingStatusType = Pick<LoaderProps, "connector" | "externalWalletsConfig" | "walletRegistry" | "handleMobileVerifyConnect">;
@@ -1,4 +1,4 @@
1
- import type { ChainNamespaceType, WalletRegistry } from "@web3auth/no-modal";
1
+ import type { ChainNamespaceType, WALLET_CONNECTOR_TYPE, WalletRegistry } from "@web3auth/no-modal";
2
2
  import { browser, ModalState, os, platform, SocialLoginEventType, SocialLoginsConfig, UIConfig } from "../../interfaces";
3
3
  export interface RootProps {
4
4
  appLogo?: string;
@@ -29,4 +29,8 @@ export interface RootProps {
29
29
  }) => void;
30
30
  setModalState: (state: ModalState) => void;
31
31
  onCloseLoader: () => void;
32
+ isConnectAndSignAuthenticationMode: boolean;
33
+ handleMobileVerifyConnect: (params: {
34
+ connector: WALLET_CONNECTOR_TYPE;
35
+ }) => void;
32
36
  }
@@ -1,5 +1,5 @@
1
1
  import { SafeEventEmitter } from "@web3auth/auth";
2
- import { ChainNamespaceType, WalletRegistry } from "@web3auth/no-modal";
2
+ import { ChainNamespaceType, ConnectorInitialAuthenticationModeType, WALLET_CONNECTOR_TYPE, WalletRegistry } from "@web3auth/no-modal";
3
3
  import { browser, ExternalWalletEventType, os, platform, SocialLoginEventType, StateEmitterEvents, UIConfig } from "../../interfaces";
4
4
  export interface WidgetProps {
5
5
  stateListener: SafeEventEmitter<StateEmitterEvents>;
@@ -8,6 +8,7 @@ export interface WidgetProps {
8
8
  chainNamespaces: ChainNamespaceType[];
9
9
  walletRegistry?: WalletRegistry;
10
10
  uiConfig: UIConfig;
11
+ initialAuthenticationMode: ConnectorInitialAuthenticationModeType;
11
12
  deviceDetails: {
12
13
  platform: platform;
13
14
  browser: browser;
@@ -15,6 +16,9 @@ export interface WidgetProps {
15
16
  };
16
17
  handleSocialLoginClick: (params: SocialLoginEventType) => void;
17
18
  handleExternalWalletClick: (params: ExternalWalletEventType) => void;
19
+ handleMobileVerifyConnect: (params: {
20
+ connector: WALLET_CONNECTOR_TYPE;
21
+ }) => void;
18
22
  handleShowExternalWallets: (externalWalletsInitialized: boolean) => void;
19
23
  closeModal: () => void;
20
24
  }
@@ -1,5 +1,5 @@
1
1
  import type { AUTH_CONNECTION_TYPE, BUILD_ENV_TYPE, EMAIL_FLOW_TYPE, ExtraLoginOptions, LANGUAGES, SafeEventEmitter, THEME_MODE_TYPE, WEB3AUTH_NETWORK_TYPE } from "@web3auth/auth";
2
- import { type Analytics, type AuthLoginParams, type BaseConnectorConfig, type ChainNamespaceType, type LoginMethodConfig, type LoginModalConfig, type UIConfig as CoreUIConfig, type WALLET_CONNECTOR_TYPE, type WalletRegistry, type WalletRegistryItem, type Web3AuthNoModalEvents } from "@web3auth/no-modal";
2
+ import { type Analytics, type AuthLoginParams, type BaseConnectorConfig, type ChainNamespaceType, type ConnectorInitialAuthenticationModeType, type LoginMethodConfig, type LoginModalConfig, type UIConfig as CoreUIConfig, type WALLET_CONNECTOR_TYPE, type WalletRegistry, type WalletRegistryItem, type Web3AuthNoModalEvents } from "@web3auth/no-modal";
3
3
  export interface UIConfig extends CoreUIConfig, LoginModalConfig {
4
4
  /**
5
5
  * ID of the element to embed the widget into
@@ -42,6 +42,7 @@ export type ModalLoginParams = Pick<AuthLoginParams, "authConnection" | "authCon
42
42
  name: string;
43
43
  };
44
44
  export interface LoginModalProps extends UIConfig {
45
+ initialAuthenticationMode: ConnectorInitialAuthenticationModeType;
45
46
  chainNamespaces: ChainNamespaceType[];
46
47
  walletRegistry: WalletRegistry;
47
48
  web3authClientId: string;
@@ -64,6 +65,9 @@ export interface LoginModalCallbacks {
64
65
  };
65
66
  }) => Promise<void>;
66
67
  onModalVisibility: (visibility: boolean) => Promise<void>;
68
+ onMobileVerifyConnect: (params: {
69
+ connector: WALLET_CONNECTOR_TYPE;
70
+ }) => Promise<void>;
67
71
  }
68
72
  export declare const LOGIN_MODAL_EVENTS: {
69
73
  readonly MODAL_VISIBILITY: "MODAL_VISIBILITY";
@@ -79,6 +83,8 @@ export declare const MODAL_STATUS: {
79
83
  readonly CONNECTED: "connected";
80
84
  readonly CONNECTING: "connecting";
81
85
  readonly ERRORED: "errored";
86
+ readonly AUTHORIZING: "authorizing";
87
+ readonly AUTHORIZED: "authorized";
82
88
  };
83
89
  export type ModalStatusType = (typeof MODAL_STATUS)[keyof typeof MODAL_STATUS];
84
90
  export interface ModalState {
@@ -28,6 +28,7 @@ export declare class LoginModal {
28
28
  initExternalWalletContainer: () => void;
29
29
  private handleShowExternalWallets;
30
30
  private handleExternalWalletClick;
31
+ private handleMobileVerifyConnect;
31
32
  private handleSocialLoginClick;
32
33
  private setState;
33
34
  private handleConnectorData;
@@ -9,6 +9,7 @@ export interface Web3AuthProviderProps {
9
9
  }
10
10
  interface IBaseWeb3AuthComposableContext {
11
11
  isConnected: Ref<boolean>;
12
+ isAuthorized: Ref<boolean>;
12
13
  provider: Ref<IProvider | null>;
13
14
  isInitializing: Ref<boolean>;
14
15
  initError: Ref<Error | null>;
@@ -1,6 +1,6 @@
1
1
  import { EVM_CONNECTORS } from '@web3auth/no-modal';
2
2
 
3
- const version = "10.8.3";
3
+ const version = "10.9.0-alpha.0";
4
4
  const defaultConnectorsModalConfig = {
5
5
  hideWalletDiscovery: false,
6
6
  connectors: {
@@ -1,7 +1,7 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
3
  import { serializeError } from '@web3auth/auth';
4
- import { Web3AuthNoModal, cloneDeep, WALLET_CONNECTORS, LOGIN_MODE, log, CONNECTOR_STATUS, sdkVersion, ANALYTICS_SDK_TYPE, withAbort, CONNECTOR_EVENTS, ANALYTICS_EVENTS, getErrorAnalyticsProperties, WalletInitializationError, fetchProjectConfig, fetchWalletRegistry, WALLET_REGISTRY_URL, CONNECTOR_CATEGORY, CONNECTOR_NAMES, CONNECTOR_NAMESPACES } from '@web3auth/no-modal';
4
+ import { Web3AuthNoModal, cloneDeep, WALLET_CONNECTORS, LOGIN_MODE, log, CONNECTOR_STATUS, CONNECTED_STATUSES, sdkVersion, ANALYTICS_SDK_TYPE, withAbort, CONNECTOR_EVENTS, ANALYTICS_EVENTS, getErrorAnalyticsProperties, WalletInitializationError, CONNECTOR_INITIAL_AUTHENTICATION_MODE, fetchProjectConfig, fetchWalletRegistry, WALLET_REGISTRY_URL, CONNECTOR_CATEGORY, CONNECTOR_NAMES, CONNECTOR_NAMESPACES } from '@web3auth/no-modal';
5
5
  import deepmerge from 'deepmerge';
6
6
  import { defaultConnectorsModalConfig } from './config.js';
7
7
  import { AUTH_PROVIDERS_NAMES, AUTH_PROVIDERS, capitalizeFirstLetter } from './ui/config.js';
@@ -70,12 +70,20 @@ class Web3Auth extends Web3AuthNoModal {
70
70
  log.error(`Error while disconnecting to wallet connect in core`, error);
71
71
  }
72
72
  }
73
- if (!visibility && this.status === CONNECTOR_STATUS.CONNECTED && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
73
+ if (!visibility && CONNECTED_STATUSES.includes(this.status) && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
74
74
  log.debug("this stops wc connector from trying to reconnect once proposal expires");
75
75
  wcConnector.status = CONNECTOR_STATUS.READY;
76
76
  }
77
77
  }
78
78
  });
79
+ _defineProperty(this, "onMobileVerifyConnect", async params => {
80
+ try {
81
+ const connector = this.getConnector(params.connector);
82
+ await connector.getIdentityToken();
83
+ } catch (error) {
84
+ log.error(`Error while connecting to connector: ${params.connector}`, error);
85
+ }
86
+ });
79
87
  _defineProperty(this, "getChainNamespaces", () => {
80
88
  var _this$coreOptions$cha;
81
89
  return [...new Set(((_this$coreOptions$cha = this.coreOptions.chains) === null || _this$coreOptions$cha === void 0 ? void 0 : _this$coreOptions$cha.map(x => x.chainNamespace)) || [])];
@@ -138,12 +146,14 @@ class Web3Auth extends Web3AuthNoModal {
138
146
  authBuildEnv: this.options.authBuildEnv,
139
147
  chainNamespaces: this.getChainNamespaces(),
140
148
  walletRegistry: filteredWalletRegistry,
141
- analytics: this.analytics
149
+ analytics: this.analytics,
150
+ initialAuthenticationMode: this.options.initialAuthenticationMode
142
151
  }), {
143
152
  onInitExternalWallets: this.onInitExternalWallets,
144
153
  onSocialLogin: this.onSocialLogin,
145
154
  onExternalWalletLogin: this.onExternalWalletLogin,
146
- onModalVisibility: this.onModalVisibility
155
+ onModalVisibility: this.onModalVisibility,
156
+ onMobileVerifyConnect: this.onMobileVerifyConnect
147
157
  });
148
158
  await withAbort(() => this.loginModal.initModal(), signal);
149
159
 
@@ -199,7 +209,7 @@ class Web3Auth extends Web3AuthNoModal {
199
209
  async connect() {
200
210
  if (!this.loginModal) throw WalletInitializationError.notReady("Login modal is not initialized");
201
211
  // if already connected return provider
202
- if (this.connectedConnectorName && this.status === CONNECTOR_STATUS.CONNECTED && this.provider) return this.provider;
212
+ if (this.connectedConnectorName && CONNECTED_STATUSES.includes(this.status) && this.provider) return this.provider;
203
213
  this.loginModal.open();
204
214
  return new Promise((resolve, reject) => {
205
215
  // remove all listeners when promise is resolved or rejected.
@@ -211,18 +221,24 @@ class Web3Auth extends Web3AuthNoModal {
211
221
  };
212
222
  const handleError = err => {
213
223
  this.removeListener(CONNECTOR_EVENTS.CONNECTED, handleConnected);
224
+ this.removeListener(CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
214
225
  this.removeListener(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
215
226
  return reject(err);
216
227
  };
217
228
  const handleVisibility = visibility => {
218
229
  // modal is closed but user is not connected to any wallet.
219
- if (!visibility && this.status !== CONNECTOR_STATUS.CONNECTED) {
230
+ if (!visibility && !CONNECTED_STATUSES.includes(this.status)) {
220
231
  this.removeListener(CONNECTOR_EVENTS.CONNECTED, handleConnected);
221
232
  this.removeListener(CONNECTOR_EVENTS.ERRORED, handleError);
233
+ this.removeListener(CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
222
234
  return reject(new Error("User closed the modal"));
223
235
  }
224
236
  };
225
- this.once(CONNECTOR_EVENTS.CONNECTED, handleConnected);
237
+ if (this.coreOptions.initialAuthenticationMode === CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN) {
238
+ this.once(CONNECTOR_EVENTS.AUTHORIZED, handleConnected);
239
+ } else {
240
+ this.once(CONNECTOR_EVENTS.CONNECTED, handleConnected);
241
+ }
226
242
  this.once(CONNECTOR_EVENTS.ERRORED, handleError);
227
243
  this.once(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
228
244
  });
@@ -1,4 +1,4 @@
1
- import { EVM_PLUGINS, CONNECTOR_STATUS, PLUGIN_EVENTS } from '@web3auth/no-modal';
1
+ import { EVM_PLUGINS, CONNECTED_STATUSES, PLUGIN_EVENTS } from '@web3auth/no-modal';
2
2
  import { createContext, useContext, useState, useEffect, useMemo, createElement } from 'react';
3
3
 
4
4
  const WalletServicesContext = /*#__PURE__*/createContext(null);
@@ -26,7 +26,7 @@ function WalletServicesContextProvider({
26
26
  const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
27
27
  setWalletServicesPlugin(plugin);
28
28
  // when rehydrating, the connectedListener may be registered after the connected event is emitted, we need to check the status here
29
- if ((plugin === null || plugin === void 0 ? void 0 : plugin.status) === CONNECTOR_STATUS.CONNECTED) setReady(true);
29
+ if (CONNECTED_STATUSES.includes(plugin === null || plugin === void 0 ? void 0 : plugin.status)) setReady(true);
30
30
  }
31
31
  }, [isConnected, getPlugin, walletServicesPlugin]);
32
32
  useEffect(() => {
@@ -24,6 +24,7 @@ function Web3AuthInnerProvider(params) {
24
24
  return new Web3Auth(web3AuthOptions, initialState);
25
25
  }, [web3AuthOptions, initialState]);
26
26
  const [isConnected, setIsConnected] = useState(web3Auth.status === CONNECTOR_STATUS.CONNECTED);
27
+ const [isAuthorized, setIsAuthorized] = useState(web3Auth.status === CONNECTOR_STATUS.AUTHORIZED);
27
28
  const [status, setStatus] = useState(web3Auth.status);
28
29
  const getPlugin = useCallback(name => {
29
30
  if (!web3Auth) throw WalletInitializationError.notReady();
@@ -64,7 +65,9 @@ function Web3AuthInnerProvider(params) {
64
65
  if (provider) {
65
66
  provider.on("chainChanged", handleChainChange);
66
67
  return () => {
67
- provider.off("chainChanged", handleChainChange);
68
+ if (provider) {
69
+ provider.off("chainChanged", handleChainChange);
70
+ }
68
71
  };
69
72
  }
70
73
  }, [web3Auth, provider]);
@@ -83,9 +86,17 @@ function Web3AuthInnerProvider(params) {
83
86
  setProvider(data.provider);
84
87
  }
85
88
  };
89
+ const authorizedListener = _data => {
90
+ setStatus(web3Auth.status);
91
+ if (web3Auth.status === CONNECTOR_STATUS.AUTHORIZED) {
92
+ setIsConnected(true);
93
+ setIsAuthorized(true);
94
+ }
95
+ };
86
96
  const disconnectedListener = () => {
87
97
  setStatus(web3Auth.status);
88
98
  setIsConnected(false);
99
+ setIsAuthorized(false);
89
100
  setProvider(null);
90
101
  };
91
102
  const connectingListener = () => {
@@ -97,6 +108,7 @@ function Web3AuthInnerProvider(params) {
97
108
  const rehydrationErrorListener = () => {
98
109
  setStatus(web3Auth.status);
99
110
  setIsConnected(false);
111
+ setIsAuthorized(false);
100
112
  setProvider(null);
101
113
  };
102
114
  const mfaEnabledListener = isMFAEnabled => {
@@ -108,6 +120,7 @@ function Web3AuthInnerProvider(params) {
108
120
  web3Auth.on(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
109
121
  web3Auth.on(CONNECTOR_EVENTS.READY, readyListener);
110
122
  web3Auth.on(CONNECTOR_EVENTS.CONNECTED, connectedListener);
123
+ web3Auth.on(CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
111
124
  web3Auth.on(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
112
125
  web3Auth.on(CONNECTOR_EVENTS.CONNECTING, connectingListener);
113
126
  web3Auth.on(CONNECTOR_EVENTS.ERRORED, errorListener);
@@ -119,6 +132,7 @@ function Web3AuthInnerProvider(params) {
119
132
  web3Auth.off(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
120
133
  web3Auth.off(CONNECTOR_EVENTS.READY, readyListener);
121
134
  web3Auth.off(CONNECTOR_EVENTS.CONNECTED, connectedListener);
135
+ web3Auth.off(CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
122
136
  web3Auth.off(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
123
137
  web3Auth.off(CONNECTOR_EVENTS.CONNECTING, connectingListener);
124
138
  web3Auth.off(CONNECTOR_EVENTS.ERRORED, errorListener);
@@ -132,6 +146,7 @@ function Web3AuthInnerProvider(params) {
132
146
  return {
133
147
  web3Auth,
134
148
  isConnected,
149
+ isAuthorized,
135
150
  isInitialized,
136
151
  provider,
137
152
  status,
@@ -143,7 +158,7 @@ function Web3AuthInnerProvider(params) {
143
158
  getPlugin,
144
159
  setIsMFAEnabled
145
160
  };
146
- }, [web3Auth, isConnected, isMFAEnabled, setIsMFAEnabled, isInitialized, provider, status, getPlugin, isInitializing, initError, chainId, chainNamespace]);
161
+ }, [web3Auth, isConnected, isAuthorized, isMFAEnabled, setIsMFAEnabled, isInitialized, provider, status, getPlugin, isInitializing, initError, chainId, chainNamespace]);
147
162
  return /*#__PURE__*/createElement(Web3AuthInnerContext.Provider, {
148
163
  value
149
164
  }, children);
@@ -4,7 +4,7 @@ import { useWeb3AuthInner } from './useWeb3AuthInner.js';
4
4
  const useIdentityToken = () => {
5
5
  const {
6
6
  web3Auth,
7
- isConnected
7
+ isAuthorized
8
8
  } = useWeb3AuthInner();
9
9
  const [loading, setLoading] = useState(false);
10
10
  const [error, setError] = useState(null);
@@ -25,10 +25,14 @@ const useIdentityToken = () => {
25
25
  }
26
26
  }, [web3Auth]);
27
27
  useEffect(() => {
28
- if (!isConnected && token) {
28
+ if (!web3Auth) return;
29
+ if (!isAuthorized && token) {
29
30
  setToken(null);
30
31
  }
31
- }, [isConnected, token]);
32
+ if (isAuthorized && !token) {
33
+ setToken(web3Auth.idToken);
34
+ }
35
+ }, [isAuthorized, token, web3Auth]);
32
36
  return {
33
37
  loading,
34
38
  error,
@@ -4,6 +4,7 @@ const useWeb3Auth = () => {
4
4
  const {
5
5
  initError,
6
6
  isConnected,
7
+ isAuthorized,
7
8
  isInitialized,
8
9
  isInitializing,
9
10
  provider,
@@ -14,6 +15,7 @@ const useWeb3Auth = () => {
14
15
  return {
15
16
  initError,
16
17
  isConnected,
18
+ isAuthorized,
17
19
  isInitialized,
18
20
  isInitializing,
19
21
  provider,
@@ -9,7 +9,9 @@ function BottomSheet({
9
9
  isShown,
10
10
  onClose,
11
11
  children,
12
- uiConfig
12
+ uiConfig,
13
+ sheetClassName,
14
+ showCloseButton = true
13
15
  }) {
14
16
  const {
15
17
  borderRadiusType = "large"
@@ -32,8 +34,8 @@ function BottomSheet({
32
34
  "w3a--rounded-[30px]": borderRadiusType === "large",
33
35
  "w3a--rounded-2xl": borderRadiusType === "medium",
34
36
  "w3a--rounded-none": borderRadiusType === "small"
35
- }),
36
- children: [/*#__PURE__*/jsx("div", {
37
+ }, sheetClassName),
38
+ children: [showCloseButton && /*#__PURE__*/jsx("div", {
37
39
  className: "w3a--absolute w3a--right-4 w3a--top-[16px] w3a--z-10 w3a--cursor-pointer",
38
40
  children: /*#__PURE__*/jsx("svg", {
39
41
  width: "13",
@@ -0,0 +1,86 @@
1
+ import { cn } from '../../utils.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ function toSize(value, fallback = 160) {
5
+ return value !== null && value !== void 0 ? value : fallback;
6
+ }
7
+ const CircularLoader = props => {
8
+ const {
9
+ width,
10
+ height,
11
+ thickness = 12,
12
+ className = "",
13
+ children,
14
+ showChildren = true,
15
+ trackColor = "rgba(226, 232, 240, 1)",
16
+ // Tailwind slate-200 equivalent
17
+ gradient,
18
+ arcSizeDeg = 36,
19
+ arcColors
20
+ } = props;
21
+ const w = toSize(width, 160);
22
+ const h = toSize(height, 160);
23
+ const ringMask = `radial-gradient(farthest-side, transparent calc(100% - ${thickness}px), #000 calc(100% - ${thickness}px))`;
24
+ function hexToRgba(hex, alpha) {
25
+ const normalized = hex.replace("#", "");
26
+ const full = normalized.length === 3 ? normalized.split("").map(c => c + c).join("") : normalized;
27
+ const r = parseInt(full.substring(0, 2), 16);
28
+ const g = parseInt(full.substring(2, 4), 16);
29
+ const b = parseInt(full.substring(4, 6), 16);
30
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
31
+ }
32
+ function withAlpha(color, alpha) {
33
+ if (!color) return color;
34
+ const c = color.trim().toLowerCase();
35
+ if (c.startsWith("#")) return hexToRgba(c, alpha);
36
+ if (c.startsWith("rgba(")) return color;
37
+ if (c.startsWith("rgb(")) {
38
+ const nums = c.slice(4, -1);
39
+ return `rgba(${nums}, ${alpha})`;
40
+ }
41
+ // Fallback: return the same color (alpha may be ignored by browser)
42
+ return color;
43
+ }
44
+ const arcColorGradient = gradient || (arcColors ? `radial-gradient(210.91% 85.29% at 14.56% 18.67%, ${withAlpha(arcColors[0], 0)} 9.5%, ${arcColors[1]} 41.82%, ${arcColors[1]} 64.83%, ${withAlpha(arcColors[0], 0.44)} 100%)` : "radial-gradient(210.91% 85.29% at 14.56% 18.67%, rgba(255, 98, 58, 0.00) 9.5%, #FF623A 41.82%, #FF623A 64.83%, rgba(255, 98, 58, 0.44) 100%)");
45
+ const wedgeMask = `conic-gradient(#000 0deg ${arcSizeDeg}deg, transparent ${arcSizeDeg}deg 360deg)`;
46
+ return /*#__PURE__*/jsxs("div", {
47
+ className: cn("w3a--relative w3a--inline-flex w3a--items-center w3a--justify-center", className),
48
+ style: {
49
+ width: w,
50
+ height: h
51
+ },
52
+ children: [/*#__PURE__*/jsx("div", {
53
+ className: "w3a--absolute w3a--inset-0 w3a--rounded-full",
54
+ style: {
55
+ background: trackColor,
56
+ WebkitMaskImage: ringMask,
57
+ maskImage: ringMask,
58
+ WebkitMaskRepeat: "no-repeat",
59
+ maskRepeat: "no-repeat"
60
+ }
61
+ }), /*#__PURE__*/jsx("div", {
62
+ className: "w3a--absolute w3a--inset-0 w3a--animate-spin",
63
+ style: {
64
+ WebkitMaskImage: wedgeMask,
65
+ maskImage: wedgeMask,
66
+ WebkitMaskRepeat: "no-repeat",
67
+ maskRepeat: "no-repeat"
68
+ },
69
+ children: /*#__PURE__*/jsx("div", {
70
+ className: "w3a--absolute w3a--inset-0 w3a--rounded-full",
71
+ style: {
72
+ background: arcColorGradient,
73
+ WebkitMaskImage: ringMask,
74
+ maskImage: ringMask,
75
+ WebkitMaskRepeat: "no-repeat",
76
+ maskRepeat: "no-repeat"
77
+ }
78
+ })
79
+ }), showChildren && children ? /*#__PURE__*/jsx("div", {
80
+ className: "w3a--relative",
81
+ children: children
82
+ }) : null]
83
+ });
84
+ };
85
+
86
+ export { CircularLoader as default };
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import { WALLET_CONNECTORS, ANALYTICS_EVENTS, log } from '@web3auth/no-modal';
3
- import { useContext, useState, useMemo, useEffect } from 'react';
3
+ import { useContext, useState, useMemo } from 'react';
4
4
  import { CONNECT_WALLET_PAGES } from '../../constants.js';
5
5
  import { AnalyticsContext } from '../../context/AnalyticsContext.js';
6
6
  import { RootContext } from '../../context/RootContext.js';
@@ -116,6 +116,7 @@ function ConnectWallet(props) {
116
116
  };
117
117
  const handleChainFilterChange = chain => {
118
118
  setSelectedChain(chain);
119
+ setIsShowAllWallets(false);
119
120
  };
120
121
  const filteredButtons = useMemo(() => {
121
122
  if (walletDiscoverySupported) {
@@ -135,16 +136,6 @@ function ConnectWallet(props) {
135
136
  return walletDiscoverySupported ? defaultButtons.length : installedWalletButtons.length;
136
137
  }, [walletDiscoverySupported, defaultButtons, installedWalletButtons, isShowAllWallets, totalExternalWalletsCount]);
137
138
 
138
- // Automatically show all wallets if there are less than or equal to 15 wallets
139
- // also resets everytime we search causing no. of wallets to change or select different chain
140
- useEffect(() => {
141
- if (walletDiscoverySupported && totalExternalWalletsCount <= 15) {
142
- setIsShowAllWallets(true);
143
- } else {
144
- setIsShowAllWallets(false);
145
- }
146
- }, [walletDiscoverySupported, selectedChain, totalExternalWalletsCount]);
147
-
148
139
  /**
149
140
  * Wallet click logic
150
141
  * - For installed wallets
@@ -272,8 +263,7 @@ function ConnectWallet(props) {
272
263
  isDark: isDark,
273
264
  deviceDetails: deviceDetails,
274
265
  walletConnectUri: walletConnectUri,
275
- buttonRadius: buttonRadius,
276
- isShowAllWallets: isShowAllWallets
266
+ buttonRadius: buttonRadius
277
267
  })]
278
268
  })]
279
269
  });
@@ -41,7 +41,7 @@ const ConnectWalletChainNamespaceSelect = props => {
41
41
  extension: wallet.imgExtension
42
42
  })
43
43
  }), /*#__PURE__*/jsx("p", {
44
- className: "w3a--my-6 w3a--text-center w3a--text-sm w3a--text-app-gray-500",
44
+ className: "w3a--my-6 w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
45
45
  children: t("modal.external.select-chain-description", {
46
46
  wallet: wallet.displayName
47
47
  })
@@ -70,7 +70,7 @@ const ConnectWalletChainNamespaceSelect = props => {
70
70
  isButton: true,
71
71
  extension: "svg"
72
72
  }), /*#__PURE__*/jsx("p", {
73
- className: "w3a--ml-2 w3a--text-left w3a--text-sm first-letter:w3a--capitalize",
73
+ className: "w3a--ml-2 w3a--text-left w3a--text-sm w3a--text-app-gray-900 first-letter:w3a--capitalize dark:w3a--text-app-gray-200",
74
74
  children: displayName
75
75
  })]
76
76
  }), /*#__PURE__*/jsx("img", {
@@ -1,3 +1,4 @@
1
+ import { useState } from 'react';
1
2
  import { useTranslation } from 'react-i18next';
2
3
  import i18nInstance from '../../../localeImport.js';
3
4
  import { cn, getIcons } from '../../../utils.js';
@@ -111,17 +112,17 @@ function ConnectWalletList(props) {
111
112
  isDark,
112
113
  deviceDetails,
113
114
  walletConnectUri,
114
- buttonRadius,
115
- isShowAllWallets
115
+ buttonRadius
116
116
  } = props;
117
+ const [showMoreWallets, setShowMoreWallets] = useState(true);
117
118
  const onShowMoreWalletsClick = () => {
119
+ setShowMoreWallets(false);
118
120
  handleMoreWallets();
119
121
  };
120
- const showMoreWalletsButton = !isShowAllWallets;
121
122
  return /*#__PURE__*/jsxs(Fragment, {
122
123
  children: [/*#__PURE__*/jsx("ul", {
123
124
  className: cn("w3a--overflow-y-auto w3a--flex w3a--flex-col w3a--gap-y-2 w3a--h-[280px] w3a--social-container w3a--pr-2.5", {
124
- "w3a--h-[328px]": !showMoreWalletsButton
125
+ "w3a--h-[328px]": !showMoreWallets
125
126
  }),
126
127
  children: externalButtons.length === 0 ? /*#__PURE__*/jsx(NoWalletsFound, {}) : /*#__PURE__*/jsx(WalletsFound, {
127
128
  externalButtons: externalButtons,
@@ -131,7 +132,7 @@ function ConnectWalletList(props) {
131
132
  walletConnectUri: walletConnectUri,
132
133
  buttonRadius: buttonRadius
133
134
  })
134
- }), showMoreWalletsButton && !isLoading && initialWalletCount < totalExternalWalletsCount && /*#__PURE__*/jsx(MoreWalletsButton, {
135
+ }), showMoreWallets && totalExternalWalletsCount > 15 && !isLoading && initialWalletCount < totalExternalWalletsCount && /*#__PURE__*/jsx(MoreWalletsButton, {
135
136
  totalExternalWalletsCount: totalExternalWalletsCount,
136
137
  initialWalletCount: initialWalletCount,
137
138
  handleMoreWallets: onShowMoreWalletsClick,