@web3auth/modal 10.0.0-beta.11 → 10.0.0-beta.12
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/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/connectors/coinbase-connector/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/providers/ethereum-mpc-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/providers/xrpl-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +2 -1
- package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/lib.cjs/types/connectors/coinbase-connector/index.d.ts +1 -0
- package/dist/lib.cjs/types/providers/ethereum-mpc-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/providers/xrpl-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/hooks/useIdentityToken.d.ts +2 -2
- package/dist/lib.cjs/types/vue/composables/useIdentityToken.d.ts +1 -1
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/connectors/coinbase-connector/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/providers/ethereum-mpc-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/providers/xrpl-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/modal.umd.min.js +1 -1
- package/package.json +32 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var coinbaseConnector = require('@web3auth/no-modal/connectors/coinbase-connector');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(coinbaseConnector).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return coinbaseConnector[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ethereumMpcProvider = require('@web3auth/no-modal/providers/ethereum-mpc-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(ethereumMpcProvider).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return ethereumMpcProvider[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var xrplProvider = require('@web3auth/no-modal/providers/xrpl-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(xrplProvider).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return xrplProvider[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -11,11 +11,11 @@ const useIdentityToken = () => {
|
|
|
11
11
|
const [loading, setLoading] = react.useState(false);
|
|
12
12
|
const [error, setError] = react.useState(null);
|
|
13
13
|
const [token, setToken] = react.useState(null);
|
|
14
|
-
const
|
|
14
|
+
const getIdentityToken = react.useCallback(async () => {
|
|
15
15
|
setLoading(true);
|
|
16
16
|
setError(null);
|
|
17
17
|
try {
|
|
18
|
-
const userAuthInfo = await web3Auth.
|
|
18
|
+
const userAuthInfo = await web3Auth.getIdentityToken();
|
|
19
19
|
if (userAuthInfo !== null && userAuthInfo !== void 0 && userAuthInfo.idToken) {
|
|
20
20
|
setToken(userAuthInfo.idToken);
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ const useIdentityToken = () => {
|
|
|
35
35
|
loading,
|
|
36
36
|
error,
|
|
37
37
|
token,
|
|
38
|
-
|
|
38
|
+
getIdentityToken
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -292,8 +292,9 @@ class LoginModal {
|
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
// TODO: send connector name in error
|
|
295
|
-
listener.on(noModal.CONNECTOR_EVENTS.ERRORED, error => {
|
|
295
|
+
listener.on(noModal.CONNECTOR_EVENTS.ERRORED, (error, loginMode) => {
|
|
296
296
|
noModal.log.error("error", error, error.message);
|
|
297
|
+
if (loginMode === noModal.LOGIN_MODE.NO_MODAL) return;
|
|
297
298
|
if (error.code === 5000) {
|
|
298
299
|
if (this.uiConfig.displayErrorsOnModal) this.setState({
|
|
299
300
|
modalVisibility: true,
|
|
@@ -12,12 +12,12 @@ const useIdentityToken = () => {
|
|
|
12
12
|
const loading = vue.ref(false);
|
|
13
13
|
const error = vue.ref(null);
|
|
14
14
|
const token = vue.ref(null);
|
|
15
|
-
const
|
|
15
|
+
const getIdentityToken = async () => {
|
|
16
16
|
try {
|
|
17
17
|
if (!web3Auth.value) throw noModal.WalletInitializationError.notReady();
|
|
18
18
|
error.value = null;
|
|
19
19
|
loading.value = true;
|
|
20
|
-
const result = await web3Auth.value.
|
|
20
|
+
const result = await web3Auth.value.getIdentityToken();
|
|
21
21
|
if (result !== null && result !== void 0 && result.idToken) {
|
|
22
22
|
token.value = result.idToken;
|
|
23
23
|
}
|
|
@@ -37,7 +37,7 @@ const useIdentityToken = () => {
|
|
|
37
37
|
loading,
|
|
38
38
|
error,
|
|
39
39
|
token,
|
|
40
|
-
|
|
40
|
+
getIdentityToken
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/connectors/coinbase-connector";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/providers/ethereum-mpc-provider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/providers/xrpl-provider";
|
|
@@ -3,11 +3,11 @@ export interface IUseIdentityToken {
|
|
|
3
3
|
loading: boolean;
|
|
4
4
|
error: Web3AuthError | null;
|
|
5
5
|
token: string | null;
|
|
6
|
-
|
|
6
|
+
getIdentityToken: () => Promise<string | null>;
|
|
7
7
|
}
|
|
8
8
|
export declare const useIdentityToken: () => {
|
|
9
9
|
loading: boolean;
|
|
10
10
|
error: Web3AuthError;
|
|
11
11
|
token: string;
|
|
12
|
-
|
|
12
|
+
getIdentityToken: () => Promise<string>;
|
|
13
13
|
};
|
|
@@ -4,6 +4,6 @@ export interface IUseIdentityToken {
|
|
|
4
4
|
loading: Ref<boolean>;
|
|
5
5
|
error: Ref<Web3AuthError | null>;
|
|
6
6
|
token: Ref<string | null>;
|
|
7
|
-
|
|
7
|
+
getIdentityToken: () => Promise<string | null>;
|
|
8
8
|
}
|
|
9
9
|
export declare const useIdentityToken: () => IUseIdentityToken;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@web3auth/no-modal/connectors/coinbase-connector';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@web3auth/no-modal/providers/ethereum-mpc-provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@web3auth/no-modal/providers/xrpl-provider';
|
|
@@ -9,11 +9,11 @@ const useIdentityToken = () => {
|
|
|
9
9
|
const [loading, setLoading] = useState(false);
|
|
10
10
|
const [error, setError] = useState(null);
|
|
11
11
|
const [token, setToken] = useState(null);
|
|
12
|
-
const
|
|
12
|
+
const getIdentityToken = useCallback(async () => {
|
|
13
13
|
setLoading(true);
|
|
14
14
|
setError(null);
|
|
15
15
|
try {
|
|
16
|
-
const userAuthInfo = await web3Auth.
|
|
16
|
+
const userAuthInfo = await web3Auth.getIdentityToken();
|
|
17
17
|
if (userAuthInfo !== null && userAuthInfo !== void 0 && userAuthInfo.idToken) {
|
|
18
18
|
setToken(userAuthInfo.idToken);
|
|
19
19
|
}
|
|
@@ -33,7 +33,7 @@ const useIdentityToken = () => {
|
|
|
33
33
|
loading,
|
|
34
34
|
error,
|
|
35
35
|
token,
|
|
36
|
-
|
|
36
|
+
getIdentityToken
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -293,8 +293,9 @@ class LoginModal {
|
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
// TODO: send connector name in error
|
|
296
|
-
listener.on(CONNECTOR_EVENTS.ERRORED, error => {
|
|
296
|
+
listener.on(CONNECTOR_EVENTS.ERRORED, (error, loginMode) => {
|
|
297
297
|
log.error("error", error, error.message);
|
|
298
|
+
if (loginMode === LOGIN_MODE.NO_MODAL) return;
|
|
298
299
|
if (error.code === 5000) {
|
|
299
300
|
if (this.uiConfig.displayErrorsOnModal) this.setState({
|
|
300
301
|
modalVisibility: true,
|
|
@@ -10,12 +10,12 @@ const useIdentityToken = () => {
|
|
|
10
10
|
const loading = ref(false);
|
|
11
11
|
const error = ref(null);
|
|
12
12
|
const token = ref(null);
|
|
13
|
-
const
|
|
13
|
+
const getIdentityToken = async () => {
|
|
14
14
|
try {
|
|
15
15
|
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
16
16
|
error.value = null;
|
|
17
17
|
loading.value = true;
|
|
18
|
-
const result = await web3Auth.value.
|
|
18
|
+
const result = await web3Auth.value.getIdentityToken();
|
|
19
19
|
if (result !== null && result !== void 0 && result.idToken) {
|
|
20
20
|
token.value = result.idToken;
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ const useIdentityToken = () => {
|
|
|
35
35
|
loading,
|
|
36
36
|
error,
|
|
37
37
|
token,
|
|
38
|
-
|
|
38
|
+
getIdentityToken
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|