@dynamic-labs/sdk-react-core 4.5.3 → 4.6.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/CHANGELOG.md +25 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/components/UserProfile/UserProfile.cjs +8 -1
- package/src/lib/components/UserProfile/UserProfile.js +8 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -13
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -13
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +1 -0
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs +2 -1
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js +2 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +31 -4
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +31 -4
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +1 -1
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +2 -1
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +3 -2
- package/src/lib/data/api/api.cjs +3 -4
- package/src/lib/data/api/api.js +3 -4
- package/src/lib/data/api/user/user.cjs +10 -0
- package/src/lib/data/api/user/user.d.ts +1 -0
- package/src/lib/data/api/user/user.js +10 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -1
- package/src/lib/store/internalImplementation/store.cjs +0 -2
- package/src/lib/store/internalImplementation/store.js +0 -2
- package/src/lib/store/state/projectSettings/projectSettings.cjs +15 -3
- package/src/lib/store/state/projectSettings/projectSettings.d.ts +3 -1
- package/src/lib/store/state/projectSettings/projectSettings.js +16 -5
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.cjs +6 -6
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.d.ts +2 -1
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.js +7 -7
- package/src/lib/utils/functions/storeAuthToken/storeAuthToken.cjs +3 -1
- package/src/lib/utils/functions/storeAuthToken/storeAuthToken.js +3 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.cjs +6 -4
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.d.ts +6 -3
- package/src/lib/utils/hooks/useConfirmationModal/useConfirmationModal.js +6 -4
- package/src/lib/utils/hooks/useDeleteUserAccount/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs +119 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.d.ts +7 -0
- package/src/lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js +115 -0
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +9 -3
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +10 -4
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.cjs +27 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.d.ts +2 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/FilterWalletsForExternalFunding.js +23 -0
- package/src/lib/utils/hooks/useFundWithWallet/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs +7 -4
- package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js +7 -4
- package/src/lib/utils/hooks/useValidateSession/handleUserDataOutOfSync/handleUserDataOutOfSync.cjs +2 -2
- package/src/lib/utils/hooks/useValidateSession/handleUserDataOutOfSync/handleUserDataOutOfSync.d.ts +3 -1
- package/src/lib/utils/hooks/useValidateSession/handleUserDataOutOfSync/handleUserDataOutOfSync.js +2 -2
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +16 -6
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +17 -7
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -0
- package/src/lib/views/Passkey/PasskeyRecovery/AddRecoveryEmail/AddRecoveryEmail.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/AddRecoveryEmail/AddRecoveryEmail.js +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +1 -1
- package/src/lib/views/WalletList/WalletList.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +14 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +14 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.cjs +25 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.js +21 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.cjs +5 -23
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.js +5 -23
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.js +1 -1
- package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.cjs +0 -24
- package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.d.ts +0 -3
- package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.js +0 -20
- package/src/lib/store/internalImplementation/utils/clearExpiredData/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.6.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.6.0...v4.6.1) (2025-02-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* do not show undefined subdomains ([#8060](https://github.com/dynamic-labs/dynamic-auth/issues/8060)) ([ec7ca3d](https://github.com/dynamic-labs/dynamic-auth/commit/ec7ca3d1284422f54f3a1275e1983d50912bcc34))
|
|
8
|
+
* ensure project settings is present on is-cookie-enabled ([#8057](https://github.com/dynamic-labs/dynamic-auth/issues/8057)) ([81c6495](https://github.com/dynamic-labs/dynamic-auth/commit/81c64957031633c00c9e5ecaf304269605202abb))
|
|
9
|
+
* prevent user profile widget from automatically opening when linking a new wallet ([#8020](https://github.com/dynamic-labs/dynamic-auth/issues/8020)) ([4f05ac9](https://github.com/dynamic-labs/dynamic-auth/commit/4f05ac9fdc5a2fc415567dff1b33ddffd0478804))
|
|
10
|
+
* project settings loading and cookie setting check ([#8056](https://github.com/dynamic-labs/dynamic-auth/issues/8056)) ([457a298](https://github.com/dynamic-labs/dynamic-auth/commit/457a298ff11387ca858f85fb19d6c421e02fcc88))
|
|
11
|
+
|
|
12
|
+
## [4.6.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.5.3...v4.6.0) (2025-02-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* expose method to refetch project settings ([#8048](https://github.com/dynamic-labs/dynamic-auth/issues/8048)) ([10af30c](https://github.com/dynamic-labs/dynamic-auth/commit/10af30cb5caf39b95eaae39ad831466f6f73b98a))
|
|
18
|
+
* add new hook to delete user ([#8013](https://github.com/dynamic-labs/dynamic-auth/issues/8013)) ([c312285](https://github.com/dynamic-labs/dynamic-auth/commit/c312285b4e4663eedf83a4c8c043715ba6c1a9ed))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* add memos and fix state updates to prevent rerenders ([#8024](https://github.com/dynamic-labs/dynamic-auth/issues/8024)) ([89504c0](https://github.com/dynamic-labs/dynamic-auth/commit/89504c0efa29ed846a55d7eb3213a1b9b070368a))
|
|
24
|
+
* back button not working properly in the farcaster connect view ([#8051](https://github.com/dynamic-labs/dynamic-auth/issues/8051)) ([5fe4631](https://github.com/dynamic-labs/dynamic-auth/commit/5fe463105ce43dd7ec31cd90ee6922bd917ed9de))
|
|
25
|
+
* update wallet address when switching networks in cosmos ([#8016](https://github.com/dynamic-labs/dynamic-auth/issues/8016)) ([2925784](https://github.com/dynamic-labs/dynamic-auth/commit/29257846fa99600a67cf010447248451cd17ae60))
|
|
26
|
+
|
|
2
27
|
### [4.5.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.5.2...v4.5.3) (2025-02-09)
|
|
3
28
|
|
|
4
29
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.6.1";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.622",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
11
11
|
"country-list": "2.3.0",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.
|
|
2
|
+
var version = "4.6.1";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.622",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
7
7
|
"country-list": "2.3.0",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.0.622",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
8
8
|
"country-list": "2.3.0",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
16
|
"bs58": "5.0.0",
|
|
17
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
18
|
-
"@dynamic-labs/iconic": "4.
|
|
19
|
-
"@dynamic-labs/logger": "4.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
22
|
-
"@dynamic-labs/store": "4.
|
|
23
|
-
"@dynamic-labs/types": "4.
|
|
24
|
-
"@dynamic-labs/utils": "4.
|
|
25
|
-
"@dynamic-labs/wallet-book": "4.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
17
|
+
"@dynamic-labs/assert-package-version": "4.6.1",
|
|
18
|
+
"@dynamic-labs/iconic": "4.6.1",
|
|
19
|
+
"@dynamic-labs/logger": "4.6.1",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "4.6.1",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "4.6.1",
|
|
22
|
+
"@dynamic-labs/store": "4.6.1",
|
|
23
|
+
"@dynamic-labs/types": "4.6.1",
|
|
24
|
+
"@dynamic-labs/utils": "4.6.1",
|
|
25
|
+
"@dynamic-labs/wallet-book": "4.6.1",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "4.6.1",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -153,6 +153,7 @@ var useWalletOptions = require('./lib/utils/hooks/useWalletOptions/useWalletOpti
|
|
|
153
153
|
var useSyncMfaFlow = require('./lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs');
|
|
154
154
|
var useTelegramLogin = require('./lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs');
|
|
155
155
|
var useUpgradeEmbeddedWallet = require('./lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs');
|
|
156
|
+
var useDeleteUserAccount = require('./lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs');
|
|
156
157
|
var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
|
|
157
158
|
require('./lib/components/InlineWidget/InlineWidget.cjs');
|
|
158
159
|
var IsBrowser = require('./lib/components/IsBrowser/IsBrowser.cjs');
|
|
@@ -281,6 +282,7 @@ exports.useWalletOptions = useWalletOptions.useWalletOptions;
|
|
|
281
282
|
exports.useSyncMfaFlow = useSyncMfaFlow.useSyncMfaFlow;
|
|
282
283
|
exports.useTelegramLogin = useTelegramLogin.useTelegramLogin;
|
|
283
284
|
exports.useUpgradeEmbeddedWallet = useUpgradeEmbeddedWallet.useUpgradeEmbeddedWallet;
|
|
285
|
+
exports.useDeleteUserAccount = useDeleteUserAccount.useDeleteUserAccount;
|
|
284
286
|
exports.DynamicConnectButton = DynamicConnectButton.DynamicConnectButton;
|
|
285
287
|
exports.IsBrowser = IsBrowser.IsBrowser;
|
|
286
288
|
exports.DynamicBridgeWidget = DynamicBridgeWidget.DynamicBridgeWidget;
|
package/src/index.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallet
|
|
|
114
114
|
export {
|
|
115
115
|
/** @deprecated */
|
|
116
116
|
DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
|
|
117
|
-
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, } from './lib/utils/hooks';
|
|
117
|
+
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, } from './lib/utils/hooks';
|
|
118
118
|
export {
|
|
119
119
|
/** @deprecated use useOnramp instead */
|
|
120
120
|
useFunding, } from './lib/utils/hooks/useFunding';
|
package/src/index.js
CHANGED
|
@@ -149,6 +149,7 @@ export { useWalletOptions } from './lib/utils/hooks/useWalletOptions/useWalletOp
|
|
|
149
149
|
export { useSyncMfaFlow } from './lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js';
|
|
150
150
|
export { useTelegramLogin } from './lib/utils/hooks/useTelegramLogin/useTelegramLogin.js';
|
|
151
151
|
export { useUpgradeEmbeddedWallet } from './lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js';
|
|
152
|
+
export { useDeleteUserAccount } from './lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js';
|
|
152
153
|
export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
|
|
153
154
|
import './lib/components/InlineWidget/InlineWidget.js';
|
|
154
155
|
export { IsBrowser } from './lib/components/IsBrowser/IsBrowser.js';
|
|
@@ -155,10 +155,17 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
155
155
|
// Use name instead of label here because the back-end doesn't set label
|
|
156
156
|
let fieldLabel = name;
|
|
157
157
|
if (name === fields.NAME_SERVICE_FIELD_NAME) {
|
|
158
|
+
// Field should not render if ENS domain is not set
|
|
159
|
+
if (!ensDomain) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
158
162
|
fieldLabel = t('dyn_subdomain_field.label');
|
|
159
|
-
if (
|
|
163
|
+
if (fieldValue !== '') {
|
|
160
164
|
fieldValue = `${fieldValue}.${ensDomain}`;
|
|
161
165
|
}
|
|
166
|
+
else {
|
|
167
|
+
fieldValue = '';
|
|
168
|
+
}
|
|
162
169
|
}
|
|
163
170
|
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { name: name, label: fieldLabel, value: fieldValue }, name));
|
|
164
171
|
}
|
|
@@ -151,10 +151,17 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
151
151
|
// Use name instead of label here because the back-end doesn't set label
|
|
152
152
|
let fieldLabel = name;
|
|
153
153
|
if (name === NAME_SERVICE_FIELD_NAME) {
|
|
154
|
+
// Field should not render if ENS domain is not set
|
|
155
|
+
if (!ensDomain) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
154
158
|
fieldLabel = t('dyn_subdomain_field.label');
|
|
155
|
-
if (
|
|
159
|
+
if (fieldValue !== '') {
|
|
156
160
|
fieldValue = `${fieldValue}.${ensDomain}`;
|
|
157
161
|
}
|
|
162
|
+
else {
|
|
163
|
+
fieldValue = '';
|
|
164
|
+
}
|
|
158
165
|
}
|
|
159
166
|
return (jsx(UserProfileField, { name: name, label: fieldLabel, value: fieldValue }, name));
|
|
160
167
|
}
|
|
@@ -327,7 +327,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
327
327
|
setRequiredWalletsConnected(!(bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) && Boolean(primaryWallet));
|
|
328
328
|
}, [bridgeChainsToConnect, primaryWallet]);
|
|
329
329
|
const walletConnectors = React.useMemo(() => linkedOrConnectedWallets.map((wallet) => wallet.connector), [linkedOrConnectedWallets]);
|
|
330
|
-
projectSettings.useFetchProjectSettings();
|
|
330
|
+
const { refetchProjectSettings } = projectSettings.useFetchProjectSettings();
|
|
331
331
|
nonce.useFetchNonce({
|
|
332
332
|
shouldFetch: shouldFetchNonce.shouldFetchNonce({ authMode }),
|
|
333
333
|
});
|
|
@@ -548,6 +548,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
548
548
|
qrcodeUri,
|
|
549
549
|
recommendedWallets,
|
|
550
550
|
redirectUrl: settings$1.redirectUrl,
|
|
551
|
+
refetchProjectSettings,
|
|
551
552
|
removeBridgeOnboardingCompleted,
|
|
552
553
|
removeConnectedWalletsInfo,
|
|
553
554
|
sdkHasLoaded,
|
|
@@ -663,6 +664,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
663
664
|
projectSettings$1,
|
|
664
665
|
qrcodeUri,
|
|
665
666
|
recommendedWallets,
|
|
667
|
+
refetchProjectSettings,
|
|
666
668
|
removeBridgeOnboardingCompleted,
|
|
667
669
|
removeConnectedWalletsInfo,
|
|
668
670
|
sdkHasLoaded,
|
|
@@ -723,18 +725,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
723
725
|
id: `project-settings-${environmentId}`,
|
|
724
726
|
type: 'application/json',
|
|
725
727
|
});
|
|
726
|
-
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
727
|
-
React.useEffect(() => {
|
|
728
|
-
// If statement to secure SingleWallet widget
|
|
729
|
-
if (!multiWallet && multiWalletWidgetState !== 'awaiting_account_switch') {
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
// We need to make sure that the user is logged in so that we do not try to display the widget before authorization
|
|
733
|
-
if (user$1 && multiWalletWidgetState !== 'idle' && !showDynamicUserProfile) {
|
|
734
|
-
setShowDynamicUserProfile(true);
|
|
735
|
-
}
|
|
736
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
737
|
-
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
738
728
|
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((_p = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.design) === null || _p === void 0 ? void 0 : _p.modal) || undefined), designSettings: projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialViewType: helpers.getInitialViewType({
|
|
739
729
|
bridgeOnboardingCompleted,
|
|
740
730
|
connectedWallets,
|
|
@@ -323,7 +323,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
323
323
|
setRequiredWalletsConnected(!(bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) && Boolean(primaryWallet));
|
|
324
324
|
}, [bridgeChainsToConnect, primaryWallet]);
|
|
325
325
|
const walletConnectors = useMemo(() => linkedOrConnectedWallets.map((wallet) => wallet.connector), [linkedOrConnectedWallets]);
|
|
326
|
-
useFetchProjectSettings();
|
|
326
|
+
const { refetchProjectSettings } = useFetchProjectSettings();
|
|
327
327
|
useFetchNonce({
|
|
328
328
|
shouldFetch: shouldFetchNonce({ authMode }),
|
|
329
329
|
});
|
|
@@ -544,6 +544,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
544
544
|
qrcodeUri,
|
|
545
545
|
recommendedWallets,
|
|
546
546
|
redirectUrl: settings.redirectUrl,
|
|
547
|
+
refetchProjectSettings,
|
|
547
548
|
removeBridgeOnboardingCompleted,
|
|
548
549
|
removeConnectedWalletsInfo,
|
|
549
550
|
sdkHasLoaded,
|
|
@@ -659,6 +660,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
659
660
|
projectSettings,
|
|
660
661
|
qrcodeUri,
|
|
661
662
|
recommendedWallets,
|
|
663
|
+
refetchProjectSettings,
|
|
662
664
|
removeBridgeOnboardingCompleted,
|
|
663
665
|
removeConnectedWalletsInfo,
|
|
664
666
|
sdkHasLoaded,
|
|
@@ -719,18 +721,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
719
721
|
id: `project-settings-${environmentId}`,
|
|
720
722
|
type: 'application/json',
|
|
721
723
|
});
|
|
722
|
-
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
723
|
-
useEffect(() => {
|
|
724
|
-
// If statement to secure SingleWallet widget
|
|
725
|
-
if (!multiWallet && multiWalletWidgetState !== 'awaiting_account_switch') {
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
// We need to make sure that the user is logged in so that we do not try to display the widget before authorization
|
|
729
|
-
if (user && multiWalletWidgetState !== 'idle' && !showDynamicUserProfile) {
|
|
730
|
-
setShowDynamicUserProfile(true);
|
|
731
|
-
}
|
|
732
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
733
|
-
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
734
724
|
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_p = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _p === void 0 ? void 0 : _p.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialViewType: getInitialViewType({
|
|
735
725
|
bridgeOnboardingCompleted,
|
|
736
726
|
connectedWallets,
|
|
@@ -105,6 +105,7 @@ export interface IDynamicContext {
|
|
|
105
105
|
qrcodeUri: string;
|
|
106
106
|
recommendedWallets?: RecommendedWallet[];
|
|
107
107
|
redirectUrl?: string;
|
|
108
|
+
refetchProjectSettings: () => Promise<ProjectSettings | undefined>;
|
|
108
109
|
removeConnectedWalletsInfo: () => void;
|
|
109
110
|
sdkHasLoaded: boolean;
|
|
110
111
|
secondaryWallets: Wallet[];
|
|
@@ -13,7 +13,7 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
16
|
+
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
const externalSetShowAuthFlow = React.useCallback((value) => {
|
|
19
19
|
setShowAuthFlow(value, {
|
|
@@ -41,6 +41,7 @@ const useDynamicContext = () => {
|
|
|
41
41
|
networkConfigurations,
|
|
42
42
|
primaryWallet,
|
|
43
43
|
qrcodeUri,
|
|
44
|
+
refetchProjectSettings,
|
|
44
45
|
sdkHasLoaded,
|
|
45
46
|
selectedTabIndex,
|
|
46
47
|
sendWagmiSettings,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'refetchProjectSettings' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,7 +9,7 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
12
|
+
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
const externalSetShowAuthFlow = useCallback((value) => {
|
|
15
15
|
setShowAuthFlow(value, {
|
|
@@ -37,6 +37,7 @@ const useDynamicContext = () => {
|
|
|
37
37
|
networkConfigurations,
|
|
38
38
|
primaryWallet,
|
|
39
39
|
qrcodeUri,
|
|
40
|
+
refetchProjectSettings,
|
|
40
41
|
sdkHasLoaded,
|
|
41
42
|
selectedTabIndex,
|
|
42
43
|
sendWagmiSettings,
|
package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.cjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
7
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
10
|
var getWalletAdditionalAddressByType = require('../../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.cjs');
|
|
@@ -39,7 +40,7 @@ const useEnabledOnrampProviders = ({ primaryWallet, network, environmentId, proj
|
|
|
39
40
|
],
|
|
40
41
|
initialData: [],
|
|
41
42
|
});
|
|
42
|
-
return onrampProviders.filter((p) => projectSettingsOnramps === null || projectSettingsOnramps === void 0 ? void 0 : projectSettingsOnramps.includes(p.provider));
|
|
43
|
+
return React.useMemo(() => onrampProviders.filter((p) => projectSettingsOnramps === null || projectSettingsOnramps === void 0 ? void 0 : projectSettingsOnramps.includes(p.provider)), [onrampProviders, projectSettingsOnramps]);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
exports.useEnabledOnrampProviders = useEnabledOnrampProviders;
|
package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useMemo } from 'react';
|
|
3
4
|
import { getChainInfo, isBitcoinConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
|
|
5
6
|
import { getWalletAdditionalAddressByType } from '../../../utils/functions/getWalletAdditionalAddressByType/getWalletAdditionalAddressByType.js';
|
|
@@ -35,7 +36,7 @@ const useEnabledOnrampProviders = ({ primaryWallet, network, environmentId, proj
|
|
|
35
36
|
],
|
|
36
37
|
initialData: [],
|
|
37
38
|
});
|
|
38
|
-
return onrampProviders.filter((p) => projectSettingsOnramps === null || projectSettingsOnramps === void 0 ? void 0 : projectSettingsOnramps.includes(p.provider));
|
|
39
|
+
return useMemo(() => onrampProviders.filter((p) => projectSettingsOnramps === null || projectSettingsOnramps === void 0 ? void 0 : projectSettingsOnramps.includes(p.provider)), [onrampProviders, projectSettingsOnramps]);
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
export { useEnabledOnrampProviders };
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
10
|
var localStorage = require('../../utils/constants/localStorage.cjs');
|
|
11
11
|
var getSiweStatement = require('../../utils/functions/getSiweStatement/getSiweStatement.cjs');
|
|
12
12
|
require('../../events/dynamicEvents.cjs');
|
|
@@ -92,6 +92,8 @@ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidge
|
|
|
92
92
|
require('../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
93
93
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
94
94
|
require('../OnrampContext/OnrampContext.cjs');
|
|
95
|
+
var useFundWithWallet = require('../../utils/hooks/useFundWithWallet/useFundWithWallet.cjs');
|
|
96
|
+
var getPromptAmountParams = require('../../widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.cjs');
|
|
95
97
|
require('../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
|
|
96
98
|
require('../../../index.cjs');
|
|
97
99
|
require('../../store/state/tokenBalances.cjs');
|
|
@@ -102,6 +104,7 @@ const useResponseHandlers = () => {
|
|
|
102
104
|
const { pushView } = ViewContext.useViewContext();
|
|
103
105
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
104
106
|
const { getCaptchaToken } = CaptchaContext.useCaptchaContext();
|
|
107
|
+
const { promptAmountAndFund } = useFundWithWallet.useFundWithWallet();
|
|
105
108
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
106
109
|
displaySiweStatement,
|
|
107
110
|
environmentId,
|
|
@@ -117,16 +120,40 @@ const useResponseHandlers = () => {
|
|
|
117
120
|
}
|
|
118
121
|
// this completes the connection step
|
|
119
122
|
yield phantomRedirectConnector.getSession();
|
|
120
|
-
yield connectWallet(phantomRedirectConnector);
|
|
123
|
+
const connectResult = yield connectWallet(phantomRedirectConnector);
|
|
124
|
+
// Check if we have a connection type
|
|
125
|
+
const connectionType = utils.StorageService.getItem(utils.PHANTOM_REDIRECT_CONNECTION_TYPE_KEY);
|
|
126
|
+
// If this is an external wallet funding connection, then we need to
|
|
127
|
+
// complete the wallet transfer.
|
|
128
|
+
// If connectorConsumed is false that means that the connector has not yet
|
|
129
|
+
// verified this connection type and we should ignore it.
|
|
130
|
+
if ((connectionType === null || connectionType === void 0 ? void 0 : connectionType.connectorConsumed) &&
|
|
131
|
+
connectionType.type === 'external-wallet-funding') {
|
|
132
|
+
if (!connectResult)
|
|
133
|
+
return;
|
|
134
|
+
const wallet = phantomRedirectConnector.createWallet({
|
|
135
|
+
address: connectResult.address,
|
|
136
|
+
chain: phantomRedirectConnector.connectedChain,
|
|
137
|
+
connector: phantomRedirectConnector,
|
|
138
|
+
id: 'external-funding-wallet',
|
|
139
|
+
isAuthenticated: false,
|
|
140
|
+
key: phantomRedirectConnector.key,
|
|
141
|
+
});
|
|
142
|
+
const props = getPromptAmountParams.getPromptAmountParams({ externalWallet: wallet });
|
|
143
|
+
promptAmountAndFund(props);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Default behavior is to link a wallet
|
|
121
147
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
122
148
|
pushView('pending-signature');
|
|
123
149
|
setSelectedWalletConnectorKey('phantom');
|
|
124
150
|
}), [
|
|
125
|
-
connectWallet,
|
|
126
151
|
phantomRedirectConnector,
|
|
127
|
-
|
|
152
|
+
connectWallet,
|
|
128
153
|
setShowAuthFlow,
|
|
129
154
|
pushView,
|
|
155
|
+
setSelectedWalletConnectorKey,
|
|
156
|
+
promptAmountAndFund,
|
|
130
157
|
]);
|
|
131
158
|
const completeWalletTransfer = useTransferWallet.useTransferWallet();
|
|
132
159
|
const handleUserResponse = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
+
import { StorageService, PHANTOM_REDIRECT_CONNECTION_TYPE_KEY } from '@dynamic-labs/utils';
|
|
4
5
|
import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { StorageService } from '@dynamic-labs/utils';
|
|
6
6
|
import { PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
7
7
|
import { getSiweStatement } from '../../utils/functions/getSiweStatement/getSiweStatement.js';
|
|
8
8
|
import '../../events/dynamicEvents.js';
|
|
@@ -88,6 +88,8 @@ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidget
|
|
|
88
88
|
import '../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
89
89
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
90
90
|
import '../OnrampContext/OnrampContext.js';
|
|
91
|
+
import { useFundWithWallet } from '../../utils/hooks/useFundWithWallet/useFundWithWallet.js';
|
|
92
|
+
import { getPromptAmountParams } from '../../widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/getPromptAmountParams/getPromptAmountParams.js';
|
|
91
93
|
import '../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js';
|
|
92
94
|
import '../../../index.js';
|
|
93
95
|
import '../../store/state/tokenBalances.js';
|
|
@@ -98,6 +100,7 @@ const useResponseHandlers = () => {
|
|
|
98
100
|
const { pushView } = useViewContext();
|
|
99
101
|
const { setErrorMessage } = useErrorContext();
|
|
100
102
|
const { getCaptchaToken } = useCaptchaContext();
|
|
103
|
+
const { promptAmountAndFund } = useFundWithWallet();
|
|
101
104
|
const verifyWallet = useVerifyWallet({
|
|
102
105
|
displaySiweStatement,
|
|
103
106
|
environmentId,
|
|
@@ -113,16 +116,40 @@ const useResponseHandlers = () => {
|
|
|
113
116
|
}
|
|
114
117
|
// this completes the connection step
|
|
115
118
|
yield phantomRedirectConnector.getSession();
|
|
116
|
-
yield connectWallet(phantomRedirectConnector);
|
|
119
|
+
const connectResult = yield connectWallet(phantomRedirectConnector);
|
|
120
|
+
// Check if we have a connection type
|
|
121
|
+
const connectionType = StorageService.getItem(PHANTOM_REDIRECT_CONNECTION_TYPE_KEY);
|
|
122
|
+
// If this is an external wallet funding connection, then we need to
|
|
123
|
+
// complete the wallet transfer.
|
|
124
|
+
// If connectorConsumed is false that means that the connector has not yet
|
|
125
|
+
// verified this connection type and we should ignore it.
|
|
126
|
+
if ((connectionType === null || connectionType === void 0 ? void 0 : connectionType.connectorConsumed) &&
|
|
127
|
+
connectionType.type === 'external-wallet-funding') {
|
|
128
|
+
if (!connectResult)
|
|
129
|
+
return;
|
|
130
|
+
const wallet = phantomRedirectConnector.createWallet({
|
|
131
|
+
address: connectResult.address,
|
|
132
|
+
chain: phantomRedirectConnector.connectedChain,
|
|
133
|
+
connector: phantomRedirectConnector,
|
|
134
|
+
id: 'external-funding-wallet',
|
|
135
|
+
isAuthenticated: false,
|
|
136
|
+
key: phantomRedirectConnector.key,
|
|
137
|
+
});
|
|
138
|
+
const props = getPromptAmountParams({ externalWallet: wallet });
|
|
139
|
+
promptAmountAndFund(props);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// Default behavior is to link a wallet
|
|
117
143
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
118
144
|
pushView('pending-signature');
|
|
119
145
|
setSelectedWalletConnectorKey('phantom');
|
|
120
146
|
}), [
|
|
121
|
-
connectWallet,
|
|
122
147
|
phantomRedirectConnector,
|
|
123
|
-
|
|
148
|
+
connectWallet,
|
|
124
149
|
setShowAuthFlow,
|
|
125
150
|
pushView,
|
|
151
|
+
setSelectedWalletConnectorKey,
|
|
152
|
+
promptAmountAndFund,
|
|
126
153
|
]);
|
|
127
154
|
const completeWalletTransfer = useTransferWallet();
|
|
128
155
|
const handleUserResponse = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -51,7 +51,6 @@ require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
|
51
51
|
require('../../../FieldsStateContext/FieldsStateContext.cjs');
|
|
52
52
|
require('../../../UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
53
53
|
require('@dynamic-labs/rpc-providers');
|
|
54
|
-
var useEffectOnce = require('../../../../utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
55
54
|
require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
56
55
|
require('@dynamic-labs/store');
|
|
57
56
|
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
@@ -76,6 +75,7 @@ require('qrcode');
|
|
|
76
75
|
require('../../../WalletContext/WalletContext.cjs');
|
|
77
76
|
require('formik');
|
|
78
77
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
78
|
+
var useEffectOnce = require('../../../../utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
79
79
|
require('../../../WalletGroupContext/WalletGroupContext.cjs');
|
|
80
80
|
require('../../../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
81
81
|
require('../../../ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
@@ -47,7 +47,6 @@ import '../../../../views/CollectUserDataView/useFields.js';
|
|
|
47
47
|
import '../../../FieldsStateContext/FieldsStateContext.js';
|
|
48
48
|
import '../../../UserFieldEditorContext/UserFieldEditorContext.js';
|
|
49
49
|
import '@dynamic-labs/rpc-providers';
|
|
50
|
-
import { useEffectOnce } from '../../../../utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
51
50
|
import '../../../../store/state/loadingAndLifecycle.js';
|
|
52
51
|
import '@dynamic-labs/store';
|
|
53
52
|
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
@@ -72,6 +71,7 @@ import 'qrcode';
|
|
|
72
71
|
import '../../../WalletContext/WalletContext.js';
|
|
73
72
|
import 'formik';
|
|
74
73
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
74
|
+
import { useEffectOnce } from '../../../../utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
75
75
|
import '../../../WalletGroupContext/WalletGroupContext.js';
|
|
76
76
|
import '../../../IpConfigurationContext/IpConfigurationContext.js';
|
|
77
77
|
import '../../../ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
@@ -106,7 +106,8 @@ const UserFieldEditorContextProvider = ({ children, }) => {
|
|
|
106
106
|
return (jsxRuntime.jsx(DynamicBaseWidget.DynamicBaseWidget, { children: jsxRuntime.jsx(UserFieldEditorModal.UserFieldEditorModal, { fields: modalProps.fields, submitText: modalProps.submitText, title: modalProps.title, subtitle: modalProps.subtitle, onCancel: reject, onSubmit: onSubmit }) }));
|
|
107
107
|
});
|
|
108
108
|
}), [open]);
|
|
109
|
-
|
|
109
|
+
const value = React.useMemo(() => ({ open: openUserFieldEditor }), [openUserFieldEditor]);
|
|
110
|
+
return (jsxRuntime.jsxs(UserFieldEditorContext.Provider, { value: value, children: [modal, children] }));
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
exports.UserFieldEditorContext = UserFieldEditorContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { createContext, useCallback } from 'react';
|
|
4
|
+
import { createContext, useCallback, useMemo } from 'react';
|
|
5
5
|
import { UserFieldEditorModal } from '../../modals/UserFieldEditorModal/UserFieldEditorModal.js';
|
|
6
6
|
import '../../events/dynamicEvents.js';
|
|
7
7
|
import '@dynamic-labs/utils';
|
|
@@ -102,7 +102,8 @@ const UserFieldEditorContextProvider = ({ children, }) => {
|
|
|
102
102
|
return (jsx(DynamicBaseWidget, { children: jsx(UserFieldEditorModal, { fields: modalProps.fields, submitText: modalProps.submitText, title: modalProps.title, subtitle: modalProps.subtitle, onCancel: reject, onSubmit: onSubmit }) }));
|
|
103
103
|
});
|
|
104
104
|
}), [open]);
|
|
105
|
-
|
|
105
|
+
const value = useMemo(() => ({ open: openUserFieldEditor }), [openUserFieldEditor]);
|
|
106
|
+
return (jsxs(UserFieldEditorContext.Provider, { value: value, children: [modal, children] }));
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
export { UserFieldEditorContext, UserFieldEditorContextProvider };
|
package/src/lib/data/api/api.cjs
CHANGED
|
@@ -24,8 +24,8 @@ require('@dynamic-labs/wallet-book');
|
|
|
24
24
|
require('../../shared/consts/index.cjs');
|
|
25
25
|
require('../../store/state/nonce/nonce.cjs');
|
|
26
26
|
var isCookieEnabled = require('../../utils/functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
27
|
+
var projectSettings = require('../../store/state/projectSettings/projectSettings.cjs');
|
|
27
28
|
require('../../store/state/user/user.cjs');
|
|
28
|
-
require('../../store/state/projectSettings/projectSettings.cjs');
|
|
29
29
|
require('../../locale/locale.cjs');
|
|
30
30
|
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
31
31
|
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
@@ -43,9 +43,8 @@ const sdkApi = ({ customHeaders } = {}) => {
|
|
|
43
43
|
if (deviceFingerprint) {
|
|
44
44
|
settings.headers['x-dyn-device-fingerprint'] = deviceFingerprint;
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
: undefined;
|
|
46
|
+
const projectSettings$1 = projectSettings.getProjectSettings();
|
|
47
|
+
const credentials = projectSettings$1 && isCookieEnabled.isCookieEnabled(projectSettings$1) ? 'include' : undefined;
|
|
49
48
|
settings.headers['x-dyn-version'] = `WalletKit/${version.VERSION}`;
|
|
50
49
|
settings.headers['x-dyn-api-version'] = `API/${version.API_VERSION}`;
|
|
51
50
|
return new sdkApiCore.SDKApi(new sdkApiCore.Configuration(Object.assign(Object.assign({}, settings), { credentials, fetchApi: utils.FetchService.fetch })));
|
package/src/lib/data/api/api.js
CHANGED
|
@@ -20,8 +20,8 @@ import '@dynamic-labs/wallet-book';
|
|
|
20
20
|
import '../../shared/consts/index.js';
|
|
21
21
|
import '../../store/state/nonce/nonce.js';
|
|
22
22
|
import { isCookieEnabled } from '../../utils/functions/isCookieEnabled/isCookieEnabled.js';
|
|
23
|
+
import { getProjectSettings } from '../../store/state/projectSettings/projectSettings.js';
|
|
23
24
|
import '../../store/state/user/user.js';
|
|
24
|
-
import '../../store/state/projectSettings/projectSettings.js';
|
|
25
25
|
import '../../locale/locale.js';
|
|
26
26
|
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
27
27
|
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
@@ -39,9 +39,8 @@ const sdkApi = ({ customHeaders } = {}) => {
|
|
|
39
39
|
if (deviceFingerprint) {
|
|
40
40
|
settings.headers['x-dyn-device-fingerprint'] = deviceFingerprint;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
: undefined;
|
|
42
|
+
const projectSettings = getProjectSettings();
|
|
43
|
+
const credentials = projectSettings && isCookieEnabled(projectSettings) ? 'include' : undefined;
|
|
45
44
|
settings.headers['x-dyn-version'] = `WalletKit/${VERSION}`;
|
|
46
45
|
settings.headers['x-dyn-api-version'] = `API/${API_VERSION}`;
|
|
47
46
|
return new SDKApi(new Configuration(Object.assign(Object.assign({}, settings), { credentials, fetchApi: FetchService.fetch })));
|