@web3auth/modal 4.1.0-alpha.0 → 4.1.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/modal.cjs.js +12 -8
- package/dist/modal.cjs.js.map +1 -1
- package/dist/modal.esm.js +12 -8
- package/dist/modal.esm.js.map +1 -1
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.map +1 -1
- package/dist/types/interface.d.ts +7 -1
- package/dist/types/modalManager.d.ts +4 -39
- package/dist/types/utils.d.ts +2 -0
- package/package.json +12 -12
- package/src/default.ts +1 -0
- package/src/interface.ts +13 -1
- package/src/modalManager.ts +7 -45
- package/src/utils.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseAdapterConfig, ChainNamespaceType, LoginMethodConfig, WALLET_ADAPTER_TYPE } from "@web3auth/base";
|
|
1
|
+
import type { BaseAdapterConfig, ChainNamespaceType, IWeb3Auth, LoginMethodConfig, SafeEventEmitterProvider, WALLET_ADAPTER_TYPE } from "@web3auth/base";
|
|
2
2
|
export interface ModalConfig extends BaseAdapterConfig {
|
|
3
3
|
loginMethods?: LoginMethodConfig;
|
|
4
4
|
}
|
|
@@ -6,3 +6,9 @@ export interface AdaptersModalConfig {
|
|
|
6
6
|
chainNamespace: ChainNamespaceType;
|
|
7
7
|
adapters?: Record<WALLET_ADAPTER_TYPE, ModalConfig>;
|
|
8
8
|
}
|
|
9
|
+
export interface IWeb3AuthModal extends IWeb3Auth {
|
|
10
|
+
initModal(params?: {
|
|
11
|
+
modalConfig?: Record<WALLET_ADAPTER_TYPE, ModalConfig>;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
connect(): Promise<SafeEventEmitterProvider | null>;
|
|
14
|
+
}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
import { SafeEventEmitterProvider, WALLET_ADAPTER_TYPE } from "@web3auth/base";
|
|
2
2
|
import { Web3AuthCore, Web3AuthCoreOptions } from "@web3auth/core";
|
|
3
|
-
import { LoginModal } from "@web3auth/ui";
|
|
4
|
-
import { ModalConfig } from "./interface";
|
|
5
|
-
export interface UIConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Logo for your app.
|
|
8
|
-
*/
|
|
9
|
-
appLogo?: string;
|
|
10
|
-
/**
|
|
11
|
-
* theme for the modal
|
|
12
|
-
*
|
|
13
|
-
* @defaultValue `light`
|
|
14
|
-
*/
|
|
15
|
-
theme?: "light" | "dark";
|
|
16
|
-
/**
|
|
17
|
-
* order of how login methods are shown
|
|
18
|
-
*
|
|
19
|
-
* @defaultValue `["google", "facebook", "twitter", "reddit", "discord", "twitch", "apple", "line", "github", "kakao", "linkedin", "weibo", "wechat", "email_passwordless"]`
|
|
20
|
-
*/
|
|
21
|
-
loginMethodsOrder?: string[];
|
|
22
|
-
/**
|
|
23
|
-
* language which will be used by web3auth. app will use browser language if not specified. if language is not supported it will use "en"
|
|
24
|
-
* en: english
|
|
25
|
-
* de: german
|
|
26
|
-
* ja: japanese
|
|
27
|
-
* ko: korean
|
|
28
|
-
* zh: mandarin
|
|
29
|
-
* es: spanish
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
defaultLanguage?: string;
|
|
33
|
-
}
|
|
3
|
+
import { LoginModal, UIConfig } from "@web3auth/ui";
|
|
4
|
+
import { IWeb3AuthModal, ModalConfig } from "./interface";
|
|
34
5
|
export interface Web3AuthOptions extends Web3AuthCoreOptions {
|
|
35
6
|
/**
|
|
36
7
|
* web3auth instance provides different adapters for different type of usages. If you are dapp and want to
|
|
@@ -44,15 +15,9 @@ export interface Web3AuthOptions extends Web3AuthCoreOptions {
|
|
|
44
15
|
/**
|
|
45
16
|
* Config for configuring modal ui display properties
|
|
46
17
|
*/
|
|
47
|
-
uiConfig?: UIConfig
|
|
48
|
-
/**
|
|
49
|
-
* Whether to show errors on Web3Auth modal.
|
|
50
|
-
*
|
|
51
|
-
* @defaultValue `true`
|
|
52
|
-
*/
|
|
53
|
-
displayErrorsOnModal?: boolean;
|
|
18
|
+
uiConfig?: Omit<UIConfig, "adapterListener">;
|
|
54
19
|
}
|
|
55
|
-
export declare class Web3Auth extends Web3AuthCore {
|
|
20
|
+
export declare class Web3Auth extends Web3AuthCore implements IWeb3AuthModal {
|
|
56
21
|
loginModal: LoginModal;
|
|
57
22
|
readonly options: Web3AuthOptions;
|
|
58
23
|
private modalConfig;
|
package/dist/types/utils.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web3auth/modal",
|
|
3
|
-
"version": "4.1.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"homepage": "https://github.com/Web3Auth/Web3Auth#readme",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/modal.cjs.js",
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"pre-commit": "lint-staged --cwd ."
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@web3auth/base": "^4.0.0
|
|
23
|
-
"@web3auth/core": "^4.0.0
|
|
24
|
-
"@web3auth/metamask-adapter": "^4.0.0
|
|
25
|
-
"@web3auth/openlogin-adapter": "^4.
|
|
26
|
-
"@web3auth/phantom-adapter": "^4.
|
|
27
|
-
"@web3auth/torus-evm-adapter": "^4.0.0
|
|
28
|
-
"@web3auth/torus-solana-adapter": "^4.
|
|
29
|
-
"@web3auth/ui": "^4.1.0
|
|
30
|
-
"@web3auth/wallet-connect-v1-adapter": "^4.
|
|
22
|
+
"@web3auth/base": "^4.0.0",
|
|
23
|
+
"@web3auth/core": "^4.0.0",
|
|
24
|
+
"@web3auth/metamask-adapter": "^4.0.0",
|
|
25
|
+
"@web3auth/openlogin-adapter": "^4.1.0",
|
|
26
|
+
"@web3auth/phantom-adapter": "^4.1.0",
|
|
27
|
+
"@web3auth/torus-evm-adapter": "^4.0.0",
|
|
28
|
+
"@web3auth/torus-solana-adapter": "^4.1.0",
|
|
29
|
+
"@web3auth/ui": "^4.1.0",
|
|
30
|
+
"@web3auth/wallet-connect-v1-adapter": "^4.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@svgr/webpack": "^6.5.1",
|
|
34
|
+
"@toruslabs/isomorphic-style-loader": "^5.3.3",
|
|
34
35
|
"@toruslabs/openlogin": "^2.10.0",
|
|
35
36
|
"css-loader": "^6.7.2",
|
|
36
|
-
"isomorphic-style-loader": "^5.3.2",
|
|
37
37
|
"postcss-prefix-selector": "^1.16.0",
|
|
38
38
|
"style-loader": "^3.3.1",
|
|
39
39
|
"tailwindcss": "^3.2.4",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "2f9b074a5ff464dd64bf35ecf50968c49c9b4453"
|
|
67
67
|
}
|
package/src/default.ts
CHANGED
|
@@ -39,6 +39,7 @@ export const getDefaultAdapterModule = async (params: {
|
|
|
39
39
|
const defaultOptions = getOpenloginDefaultOptions();
|
|
40
40
|
const adapter = new OpenloginAdapter({
|
|
41
41
|
...defaultOptions,
|
|
42
|
+
clientId,
|
|
42
43
|
chainConfig: { ...finalChainConfig },
|
|
43
44
|
adapterSettings: { ...(defaultOptions.adapterSettings as OpenLoginOptions), clientId },
|
|
44
45
|
});
|
package/src/interface.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
BaseAdapterConfig,
|
|
3
|
+
ChainNamespaceType,
|
|
4
|
+
IWeb3Auth,
|
|
5
|
+
LoginMethodConfig,
|
|
6
|
+
SafeEventEmitterProvider,
|
|
7
|
+
WALLET_ADAPTER_TYPE,
|
|
8
|
+
} from "@web3auth/base";
|
|
2
9
|
export interface ModalConfig extends BaseAdapterConfig {
|
|
3
10
|
loginMethods?: LoginMethodConfig;
|
|
4
11
|
}
|
|
@@ -7,3 +14,8 @@ export interface AdaptersModalConfig {
|
|
|
7
14
|
chainNamespace: ChainNamespaceType;
|
|
8
15
|
adapters?: Record<WALLET_ADAPTER_TYPE, ModalConfig>;
|
|
9
16
|
}
|
|
17
|
+
|
|
18
|
+
export interface IWeb3AuthModal extends IWeb3Auth {
|
|
19
|
+
initModal(params?: { modalConfig?: Record<WALLET_ADAPTER_TYPE, ModalConfig> }): Promise<void>;
|
|
20
|
+
connect(): Promise<SafeEventEmitterProvider | null>;
|
|
21
|
+
}
|
package/src/modalManager.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
WALLET_ADAPTERS,
|
|
13
13
|
} from "@web3auth/base";
|
|
14
14
|
import { Web3AuthCore, Web3AuthCoreOptions } from "@web3auth/core";
|
|
15
|
-
import { getAdapterSocialLogins, LOGIN_MODAL_EVENTS, LoginModal, OPENLOGIN_PROVIDERS } from "@web3auth/ui";
|
|
15
|
+
import { getAdapterSocialLogins, LOGIN_MODAL_EVENTS, LoginModal, OPENLOGIN_PROVIDERS, UIConfig } from "@web3auth/ui";
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
defaultEvmDappModalConfig,
|
|
@@ -22,41 +22,9 @@ import {
|
|
|
22
22
|
defaultSolanaWalletModalConfig,
|
|
23
23
|
} from "./config";
|
|
24
24
|
import { getDefaultAdapterModule } from "./default";
|
|
25
|
-
import { AdaptersModalConfig, ModalConfig } from "./interface";
|
|
25
|
+
import { AdaptersModalConfig, IWeb3AuthModal, ModalConfig } from "./interface";
|
|
26
26
|
import { getUserLanguage } from "./utils";
|
|
27
27
|
|
|
28
|
-
export interface UIConfig {
|
|
29
|
-
/**
|
|
30
|
-
* Logo for your app.
|
|
31
|
-
*/
|
|
32
|
-
appLogo?: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* theme for the modal
|
|
36
|
-
*
|
|
37
|
-
* @defaultValue `light`
|
|
38
|
-
*/
|
|
39
|
-
theme?: "light" | "dark";
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* order of how login methods are shown
|
|
43
|
-
*
|
|
44
|
-
* @defaultValue `["google", "facebook", "twitter", "reddit", "discord", "twitch", "apple", "line", "github", "kakao", "linkedin", "weibo", "wechat", "email_passwordless"]`
|
|
45
|
-
*/
|
|
46
|
-
loginMethodsOrder?: string[];
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* language which will be used by web3auth. app will use browser language if not specified. if language is not supported it will use "en"
|
|
50
|
-
* en: english
|
|
51
|
-
* de: german
|
|
52
|
-
* ja: japanese
|
|
53
|
-
* ko: korean
|
|
54
|
-
* zh: mandarin
|
|
55
|
-
* es: spanish
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
defaultLanguage?: string;
|
|
59
|
-
}
|
|
60
28
|
export interface Web3AuthOptions extends Web3AuthCoreOptions {
|
|
61
29
|
/**
|
|
62
30
|
* web3auth instance provides different adapters for different type of usages. If you are dapp and want to
|
|
@@ -70,16 +38,9 @@ export interface Web3AuthOptions extends Web3AuthCoreOptions {
|
|
|
70
38
|
/**
|
|
71
39
|
* Config for configuring modal ui display properties
|
|
72
40
|
*/
|
|
73
|
-
uiConfig?: UIConfig
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Whether to show errors on Web3Auth modal.
|
|
77
|
-
*
|
|
78
|
-
* @defaultValue `true`
|
|
79
|
-
*/
|
|
80
|
-
displayErrorsOnModal?: boolean;
|
|
41
|
+
uiConfig?: Omit<UIConfig, "adapterListener">;
|
|
81
42
|
}
|
|
82
|
-
export class Web3Auth extends Web3AuthCore {
|
|
43
|
+
export class Web3Auth extends Web3AuthCore implements IWeb3AuthModal {
|
|
83
44
|
public loginModal: LoginModal;
|
|
84
45
|
|
|
85
46
|
readonly options: Web3AuthOptions;
|
|
@@ -117,11 +78,12 @@ export class Web3Auth extends Web3AuthCore {
|
|
|
117
78
|
|
|
118
79
|
this.loginModal = new LoginModal({
|
|
119
80
|
theme: this.options.uiConfig?.theme,
|
|
81
|
+
appName: this.options.uiConfig?.appName || "blockchain",
|
|
120
82
|
appLogo: this.options.uiConfig?.appLogo || "",
|
|
121
|
-
version: "",
|
|
122
83
|
adapterListener: this,
|
|
123
|
-
displayErrorsOnModal: this.options.displayErrorsOnModal,
|
|
84
|
+
displayErrorsOnModal: this.options.uiConfig?.displayErrorsOnModal,
|
|
124
85
|
defaultLanguage,
|
|
86
|
+
modalZIndex: this.options.uiConfig?.modalZIndex || "99998",
|
|
125
87
|
});
|
|
126
88
|
this.subscribeToLoginModalEvents();
|
|
127
89
|
}
|