@web3auth/no-modal 10.4.0 → 10.5.1
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/base/analytics.js +2 -0
- package/dist/lib.cjs/base/constants.js +2 -0
- package/dist/lib.cjs/base/utils.js +2 -2
- package/dist/lib.cjs/connectors/auth-connector/authConnector.js +10 -2
- package/dist/lib.cjs/connectors/coinbase-connector/coinbaseConnector.js +10 -3
- package/dist/lib.cjs/connectors/injected-evm-connector/injectedEvmConnector.js +10 -3
- package/dist/lib.cjs/connectors/injected-solana-connector/walletStandardConnector.js +10 -3
- package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +11 -5
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +22 -9
- package/dist/lib.cjs/index.js +1 -0
- package/dist/lib.cjs/noModal.js +8 -1
- package/dist/lib.cjs/plugins/wallet-services-plugin/plugin.js +37 -13
- package/dist/lib.cjs/react/hooks/useFunding.js +47 -0
- package/dist/lib.cjs/react/hooks/useReceive.js +47 -0
- package/dist/lib.cjs/react/index.js +4 -0
- package/dist/lib.cjs/types/base/analytics.d.ts +2 -0
- package/dist/lib.cjs/types/base/connector/interfaces.d.ts +2 -0
- package/dist/lib.cjs/types/base/constants.d.ts +1 -0
- package/dist/lib.cjs/types/connectors/auth-connector/authConnector.d.ts +2 -4
- package/dist/lib.cjs/types/connectors/injected-evm-connector/injectedEvmConnector.d.ts +2 -4
- package/dist/lib.cjs/types/connectors/injected-solana-connector/walletStandardConnector.d.ts +2 -4
- package/dist/lib.cjs/types/plugins/wallet-services-plugin/plugin.d.ts +2 -0
- package/dist/lib.cjs/types/react/hooks/index.d.ts +2 -0
- package/dist/lib.cjs/types/react/hooks/useFunding.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useReceive.d.ts +8 -0
- package/dist/lib.cjs/types/vue/composables/index.d.ts +2 -0
- package/dist/lib.cjs/types/vue/composables/useFunding.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useReceive.d.ts +9 -0
- package/dist/lib.cjs/vue/composables/useFunding.js +47 -0
- package/dist/lib.cjs/vue/composables/useReceive.js +47 -0
- package/dist/lib.cjs/vue/index.js +4 -0
- package/dist/lib.esm/base/analytics.js +2 -0
- package/dist/lib.esm/base/constants.js +2 -1
- package/dist/lib.esm/base/utils.js +3 -3
- package/dist/lib.esm/connectors/auth-connector/authConnector.js +10 -2
- package/dist/lib.esm/connectors/coinbase-connector/coinbaseConnector.js +10 -3
- package/dist/lib.esm/connectors/injected-evm-connector/injectedEvmConnector.js +10 -3
- package/dist/lib.esm/connectors/injected-solana-connector/walletStandardConnector.js +10 -3
- package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +11 -5
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +22 -9
- package/dist/lib.esm/index.js +1 -1
- package/dist/lib.esm/noModal.js +9 -1
- package/dist/lib.esm/plugins/wallet-services-plugin/plugin.js +39 -13
- package/dist/lib.esm/react/hooks/useFunding.js +32 -0
- package/dist/lib.esm/react/hooks/useReceive.js +32 -0
- package/dist/lib.esm/react/index.js +2 -0
- package/dist/lib.esm/vue/composables/useFunding.js +32 -0
- package/dist/lib.esm/vue/composables/useReceive.js +32 -0
- package/dist/lib.esm/vue/index.js +2 -0
- package/dist/noModal.umd.min.js +1 -1
- package/package.json +2 -2
|
@@ -89,36 +89,62 @@ class WalletServicesPlugin extends SafeEventEmitter {
|
|
|
89
89
|
});
|
|
90
90
|
return this.wsEmbedInstance.showWalletConnectScanner(showWalletConnectParams);
|
|
91
91
|
}
|
|
92
|
-
async
|
|
92
|
+
async showFunding(showFundingParams) {
|
|
93
93
|
var _this$wsEmbedInstance3, _this$analytics2;
|
|
94
94
|
if (!((_this$wsEmbedInstance3 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance3 !== void 0 && _this$wsEmbedInstance3.isLoggedIn)) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
95
95
|
|
|
96
96
|
// analytics
|
|
97
|
-
(_this$analytics2 = this.analytics) === null || _this$analytics2 === void 0 || _this$analytics2.track(ANALYTICS_EVENTS.
|
|
97
|
+
(_this$analytics2 = this.analytics) === null || _this$analytics2 === void 0 || _this$analytics2.track(ANALYTICS_EVENTS.WALLET_FUNDING_CLICKED, {
|
|
98
|
+
is_visible: showFundingParams === null || showFundingParams === void 0 ? void 0 : showFundingParams.show
|
|
99
|
+
});
|
|
100
|
+
return this.wsEmbedInstance.showFunding(showFundingParams);
|
|
101
|
+
}
|
|
102
|
+
async showCheckout(showCheckoutParams) {
|
|
103
|
+
var _this$wsEmbedInstance4, _this$analytics3;
|
|
104
|
+
if (!((_this$wsEmbedInstance4 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance4 !== void 0 && _this$wsEmbedInstance4.isLoggedIn)) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
105
|
+
|
|
106
|
+
// analytics
|
|
107
|
+
(_this$analytics3 = this.analytics) === null || _this$analytics3 === void 0 || _this$analytics3.track(ANALYTICS_EVENTS.WALLET_CHECKOUT_CLICKED, {
|
|
98
108
|
is_visible: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.show,
|
|
99
109
|
receive_wallet_address_enabled: !!(showCheckoutParams !== null && showCheckoutParams !== void 0 && showCheckoutParams.receiveWalletAddress),
|
|
110
|
+
// TODO: where is the below?
|
|
111
|
+
// receive_wallet_address: showCheckoutParams?.receiveWalletAddress,
|
|
100
112
|
token_list: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.tokenList,
|
|
101
|
-
fiat_list: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.fiatList
|
|
113
|
+
fiat_list: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.fiatList,
|
|
114
|
+
crypto: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.crypto,
|
|
115
|
+
fiat: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.fiat,
|
|
116
|
+
fiat_amount: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.fiatAmount,
|
|
117
|
+
crypto_amount: showCheckoutParams === null || showCheckoutParams === void 0 ? void 0 : showCheckoutParams.cryptoAmount
|
|
102
118
|
});
|
|
103
119
|
return this.wsEmbedInstance.showCheckout(showCheckoutParams);
|
|
104
120
|
}
|
|
121
|
+
async showReceive(showReceiveParams) {
|
|
122
|
+
var _this$wsEmbedInstance5, _this$analytics4;
|
|
123
|
+
if (!((_this$wsEmbedInstance5 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance5 !== void 0 && _this$wsEmbedInstance5.isLoggedIn)) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
124
|
+
|
|
125
|
+
// analytics
|
|
126
|
+
(_this$analytics4 = this.analytics) === null || _this$analytics4 === void 0 || _this$analytics4.track(ANALYTICS_EVENTS.WALLET_RECEIVE_CLICKED, {
|
|
127
|
+
is_visible: showReceiveParams === null || showReceiveParams === void 0 ? void 0 : showReceiveParams.show
|
|
128
|
+
});
|
|
129
|
+
return this.wsEmbedInstance.showReceive(showReceiveParams);
|
|
130
|
+
}
|
|
105
131
|
async showWalletUi(showWalletUiParams) {
|
|
106
|
-
var _this$
|
|
107
|
-
if (!((_this$
|
|
132
|
+
var _this$wsEmbedInstance6, _this$analytics5;
|
|
133
|
+
if (!((_this$wsEmbedInstance6 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance6 !== void 0 && _this$wsEmbedInstance6.isLoggedIn)) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
108
134
|
|
|
109
135
|
// analytics
|
|
110
|
-
(_this$
|
|
136
|
+
(_this$analytics5 = this.analytics) === null || _this$analytics5 === void 0 || _this$analytics5.track(ANALYTICS_EVENTS.WALLET_UI_CLICKED, {
|
|
111
137
|
is_visible: showWalletUiParams === null || showWalletUiParams === void 0 ? void 0 : showWalletUiParams.show,
|
|
112
138
|
path: showWalletUiParams === null || showWalletUiParams === void 0 ? void 0 : showWalletUiParams.path
|
|
113
139
|
});
|
|
114
140
|
return this.wsEmbedInstance.showWalletUi(showWalletUiParams);
|
|
115
141
|
}
|
|
116
142
|
async showSwap(showSwapParams) {
|
|
117
|
-
var _this$
|
|
118
|
-
if (!((_this$
|
|
143
|
+
var _this$wsEmbedInstance7, _this$analytics6;
|
|
144
|
+
if (!((_this$wsEmbedInstance7 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance7 !== void 0 && _this$wsEmbedInstance7.isLoggedIn)) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
119
145
|
|
|
120
146
|
// analytics
|
|
121
|
-
(_this$
|
|
147
|
+
(_this$analytics6 = this.analytics) === null || _this$analytics6 === void 0 || _this$analytics6.track(ANALYTICS_EVENTS.WALLET_SWAP_CLICKED, {
|
|
122
148
|
is_visible: showSwapParams === null || showSwapParams === void 0 ? void 0 : showSwapParams.show,
|
|
123
149
|
from_token: showSwapParams === null || showSwapParams === void 0 ? void 0 : showSwapParams.fromToken,
|
|
124
150
|
to_token: showSwapParams === null || showSwapParams === void 0 ? void 0 : showSwapParams.toToken,
|
|
@@ -128,13 +154,13 @@ class WalletServicesPlugin extends SafeEventEmitter {
|
|
|
128
154
|
return this.wsEmbedInstance.showSwap(showSwapParams);
|
|
129
155
|
}
|
|
130
156
|
async cleanup() {
|
|
131
|
-
var _this$
|
|
132
|
-
return (_this$
|
|
157
|
+
var _this$wsEmbedInstance8;
|
|
158
|
+
return (_this$wsEmbedInstance8 = this.wsEmbedInstance) === null || _this$wsEmbedInstance8 === void 0 ? void 0 : _this$wsEmbedInstance8.cleanUp();
|
|
133
159
|
}
|
|
134
160
|
async disconnect() {
|
|
135
|
-
var _this$
|
|
161
|
+
var _this$wsEmbedInstance9;
|
|
136
162
|
if (this.status !== PLUGIN_STATUS.CONNECTED) throw WalletServicesPluginError.invalidSession("Wallet Services plugin is not connected");
|
|
137
|
-
if ((_this$
|
|
163
|
+
if ((_this$wsEmbedInstance9 = this.wsEmbedInstance) !== null && _this$wsEmbedInstance9 !== void 0 && _this$wsEmbedInstance9.isLoggedIn) {
|
|
138
164
|
await this.wsEmbedInstance.logout();
|
|
139
165
|
}
|
|
140
166
|
this.emit(PLUGIN_EVENTS.DISCONNECTED);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
3
|
+
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
4
|
+
|
|
5
|
+
const useFunding = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const showFunding = useCallback(async showFundingParams => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.showFunding(showFundingParams);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setError(error);
|
|
21
|
+
} finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
}, [plugin, ready]);
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showFunding
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useFunding };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
3
|
+
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
4
|
+
|
|
5
|
+
const useReceive = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const showReceive = useCallback(async showReceiveParams => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.showReceive(showReceiveParams);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setError(error);
|
|
21
|
+
} finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
}, [plugin, ready]);
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showReceive
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useReceive };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Web3AuthProvider } from './Web3AuthProvider.js';
|
|
2
2
|
export { useCheckout } from './hooks/useCheckout.js';
|
|
3
3
|
export { useEnableMFA } from './hooks/useEnableMFA.js';
|
|
4
|
+
export { useFunding } from './hooks/useFunding.js';
|
|
4
5
|
export { useIdentityToken } from './hooks/useIdentityToken.js';
|
|
5
6
|
export { useManageMFA } from './hooks/useManageMFA.js';
|
|
7
|
+
export { useReceive } from './hooks/useReceive.js';
|
|
6
8
|
export { useSwap } from './hooks/useSwap.js';
|
|
7
9
|
export { useSwitchChain } from './hooks/useSwitchChain.js';
|
|
8
10
|
export { useWalletConnectScanner } from './hooks/useWalletConnectScanner.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
3
|
+
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
4
|
+
|
|
5
|
+
const useFunding = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const loading = ref(false);
|
|
11
|
+
const error = ref(null);
|
|
12
|
+
const showFunding = async showFundingParams => {
|
|
13
|
+
loading.value = true;
|
|
14
|
+
error.value = null;
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.value.showFunding(showFundingParams);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
error.value = err;
|
|
21
|
+
} finally {
|
|
22
|
+
loading.value = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showFunding
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useFunding };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
3
|
+
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
4
|
+
|
|
5
|
+
const useReceive = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const loading = ref(false);
|
|
11
|
+
const error = ref(null);
|
|
12
|
+
const showReceive = async showReceiveParams => {
|
|
13
|
+
loading.value = true;
|
|
14
|
+
error.value = null;
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.value.showReceive(showReceiveParams);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
error.value = err;
|
|
21
|
+
} finally {
|
|
22
|
+
loading.value = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showReceive
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useReceive };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Web3AuthProvider } from './Web3AuthProvider.js';
|
|
2
2
|
export { useCheckout } from './composables/useCheckout.js';
|
|
3
3
|
export { useEnableMFA } from './composables/useEnableMFA.js';
|
|
4
|
+
export { useFunding } from './composables/useFunding.js';
|
|
4
5
|
export { useIdentityToken } from './composables/useIdentityToken.js';
|
|
5
6
|
export { useManageMFA } from './composables/useManageMFA.js';
|
|
7
|
+
export { useReceive } from './composables/useReceive.js';
|
|
6
8
|
export { useSwap } from './composables/useSwap.js';
|
|
7
9
|
export { useSwitchChain } from './composables/useSwitchChain.js';
|
|
8
10
|
export { useWalletConnectScanner } from './composables/useWalletConnectScanner.js';
|