@dynamic-labs/sdk-react-core 1.1.0-alpha.6 → 1.1.0-alpha.8
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 +29 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -11
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/lib/components/ChainCard/ChainCard.d.ts +2 -2
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.cjs +5 -1
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.js +5 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +18 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +18 -3
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +29 -7
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +4 -4
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +29 -7
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModalWithInit/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.cjs +54 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.d.ts +18 -0
- package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.js +50 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/FundingContext/FundingContext.cjs +4 -1
- package/src/lib/context/FundingContext/FundingContext.js +4 -1
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/locale/en/translation.cjs +20 -2
- package/src/lib/locale/en/translation.d.ts +19 -1
- package/src/lib/locale/en/translation.js +20 -2
- package/src/lib/shared/assets/alt-key.cjs +54 -0
- package/src/lib/shared/assets/alt-key.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.cjs +13 -2
- package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.js +13 -2
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +3 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +6 -1
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +3 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +18 -11
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +18 -11
- package/src/lib/utils/hooks/useWalletConnectorNetwork/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +42 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.d.ts +18 -0
- package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +38 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +19 -17
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +19 -17
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +55 -30
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +7 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +55 -31
- package/src/lib/views/LoginView/LoginView.cjs +60 -7
- package/src/lib/views/LoginView/LoginView.js +60 -7
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -4
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -4
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +3 -6
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +3 -6
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +70 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +71 -2
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.cjs +72 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.d.ts +7 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.js +68 -0
- package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/index.d.ts +1 -0
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +2 -4
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.d.ts +2 -1
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +2 -4
- package/src/lib/views/viewToComponentMap.cjs +1 -0
- package/src/lib/views/viewToComponentMap.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.cjs +76 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js +72 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +67 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +63 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +7 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +7 -5
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +8 -6
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +8 -6
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2024-01-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add new sdk view section for text ([#4280](https://github.com/dynamic-labs/DynamicAuth/issues/4280)) ([457ae38](https://github.com/dynamic-labs/DynamicAuth/commit/457ae38cd2be8dae078f40b54ffc4704299d4ed9))
|
|
8
|
+
* add new setShowLinkNewWalletModal method ([f46447a](https://github.com/dynamic-labs/DynamicAuth/commit/f46447ab606f4fdbf55e5fef21dd98f8f2650e90))
|
|
9
|
+
* add pk export for hd wallets ([#4266](https://github.com/dynamic-labs/DynamicAuth/issues/4266)) ([44aac69](https://github.com/dynamic-labs/DynamicAuth/commit/44aac69580ed44e66eab971f87cb6061a3fadc90))
|
|
10
|
+
* add starknet support for sopelia ([#4248](https://github.com/dynamic-labs/DynamicAuth/issues/4248)) ([f9a0980](https://github.com/dynamic-labs/DynamicAuth/commit/f9a0980c3cd2d6d95c5dd17b179fbd0931f08b1a))
|
|
11
|
+
* enable hardware wallet for solana wallets ([#4275](https://github.com/dynamic-labs/DynamicAuth/issues/4275)) ([704b380](https://github.com/dynamic-labs/DynamicAuth/commit/704b380186618a5a5793e88f36ccbe84b59a2e4a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* phantom solana not connecting on mobile ([#4284](https://github.com/dynamic-labs/DynamicAuth/issues/4284)) ([6ad75f1](https://github.com/dynamic-labs/DynamicAuth/commit/6ad75f152896459f5cf658227f998c246b6a572b))
|
|
17
|
+
* use bitcoin payment address for onramp ([#4273](https://github.com/dynamic-labs/DynamicAuth/issues/4273)) ([a2f54e8](https://github.com/dynamic-labs/DynamicAuth/commit/a2f54e812a11a91ee488eca64f14b5eeea1a8874))
|
|
18
|
+
|
|
19
|
+
## [1.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2023-12-28)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* better coinbase deeplinking ux ([#4164](https://github.com/dynamic-labs/DynamicAuth/issues/4164)) ([5252608](https://github.com/dynamic-labs/DynamicAuth/commit/525260851900a33a52f129def338963400344205))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* don't prompt for connect when selecting bitcoin wallet if already connected ([#4265](https://github.com/dynamic-labs/DynamicAuth/issues/4265)) ([adef402](https://github.com/dynamic-labs/DynamicAuth/commit/adef402ef94270a17fab896a8585a7f2eacd3681))
|
|
30
|
+
|
|
2
31
|
## [1.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.5...v1.1.0-alpha.6) (2023-12-27)
|
|
3
32
|
|
|
4
33
|
|
package/package.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "1.1.0-alpha.
|
|
5
|
+
var version = "1.1.0-alpha.8";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"@dynamic-labs/iconic": "0.1.47",
|
|
8
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api": "0.0.340",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
formik: "2.2.9",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var version = "1.1.0-alpha.
|
|
1
|
+
var version = "1.1.0-alpha.8";
|
|
2
2
|
var dependencies = {
|
|
3
3
|
"@dynamic-labs/iconic": "0.1.47",
|
|
4
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api": "0.0.340",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
formik: "2.2.9",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@dynamic-labs/iconic": "0.1.47",
|
|
11
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
11
|
+
"@dynamic-labs/sdk-api": "0.0.340",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
13
13
|
"country-list": "2.3.0",
|
|
14
14
|
"formik": "2.2.9",
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
"react-focus-lock": "2.9.2",
|
|
18
18
|
"react-i18next": "^13.2.0",
|
|
19
19
|
"yup": "0.32.11",
|
|
20
|
-
"@dynamic-labs/
|
|
21
|
-
"@dynamic-labs/
|
|
22
|
-
"@dynamic-labs/
|
|
23
|
-
"@dynamic-labs/
|
|
24
|
-
"@dynamic-labs/
|
|
25
|
-
"@dynamic-labs/
|
|
26
|
-
"@dynamic-labs/
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/wallet-
|
|
20
|
+
"@dynamic-labs/bitcoin": "1.1.0-alpha.8",
|
|
21
|
+
"@dynamic-labs/ethereum": "1.1.0-alpha.8",
|
|
22
|
+
"@dynamic-labs/logger": "1.1.0-alpha.8",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "1.1.0-alpha.8",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "1.1.0-alpha.8",
|
|
25
|
+
"@dynamic-labs/types": "1.1.0-alpha.8",
|
|
26
|
+
"@dynamic-labs/utils": "1.1.0-alpha.8",
|
|
27
|
+
"@dynamic-labs/viem-utils": "1.1.0-alpha.8",
|
|
28
|
+
"@dynamic-labs/wallet-book": "1.1.0-alpha.8",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "1.1.0-alpha.8",
|
|
29
30
|
"eventemitter3": "5.0.1"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -116,6 +116,7 @@ var altEmbeddedWallet = require('./lib/shared/assets/alt-embedded-wallet.cjs');
|
|
|
116
116
|
var faceId = require('./lib/shared/assets/face-id.cjs');
|
|
117
117
|
var exportEmbeddedHero = require('./lib/shared/assets/export-embedded-hero.cjs');
|
|
118
118
|
var walletV2 = require('./lib/shared/assets/wallet-v2.cjs');
|
|
119
|
+
var altKey = require('./lib/shared/assets/alt-key.cjs');
|
|
119
120
|
var index$2 = require('./lib/shared/consts/index.cjs');
|
|
120
121
|
var logger = require('./lib/shared/logger.cjs');
|
|
121
122
|
require('react-dom');
|
|
@@ -306,6 +307,7 @@ exports.AltEmbeddedWalletIcon = altEmbeddedWallet.ReactComponent;
|
|
|
306
307
|
exports.FaceIdIcon = faceId.ReactComponent;
|
|
307
308
|
exports.ExportEmbeddedHero = exportEmbeddedHero.ReactComponent;
|
|
308
309
|
exports.WalletV2Icon = walletV2.ReactComponent;
|
|
310
|
+
exports.AltKeyIcon = altKey.ReactComponent;
|
|
309
311
|
exports.authModalZIndex = index$2.authModalZIndex;
|
|
310
312
|
exports.countryCodes = index$2.countryCodes;
|
|
311
313
|
exports.defaultWalletsForChains = index$2.defaultWalletsForChains;
|
package/src/index.js
CHANGED
|
@@ -112,6 +112,7 @@ export { ReactComponent as AltEmbeddedWalletIcon } from './lib/shared/assets/alt
|
|
|
112
112
|
export { ReactComponent as FaceIdIcon } from './lib/shared/assets/face-id.js';
|
|
113
113
|
export { ReactComponent as ExportEmbeddedHero } from './lib/shared/assets/export-embedded-hero.js';
|
|
114
114
|
export { ReactComponent as WalletV2Icon } from './lib/shared/assets/wallet-v2.js';
|
|
115
|
+
export { ReactComponent as AltKeyIcon } from './lib/shared/assets/alt-key.js';
|
|
115
116
|
export { authModalZIndex, countryCodes, defaultWalletsForChains, tShirtSizes, teamNames, toolkitZIndex, tooltipZIndex, widgetModalZIndex } from './lib/shared/consts/index.js';
|
|
116
117
|
export { logger } from './lib/shared/logger.js';
|
|
117
118
|
import 'react-dom';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, MouseEventHandler } from 'react';
|
|
2
2
|
export type ChainCardProps = {
|
|
3
3
|
chainName: string;
|
|
4
|
-
onClick:
|
|
4
|
+
onClick: MouseEventHandler<HTMLDivElement>;
|
|
5
5
|
startSlot?: React.ReactElement;
|
|
6
6
|
endSlot?: React.ReactElement;
|
|
7
7
|
className?: string;
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var reactI18next = require('react-i18next');
|
|
6
7
|
var Typography = require('../Typography/Typography.cjs');
|
|
7
8
|
var IconWithSpinner = require('../IconWithSpinner/IconWithSpinner.cjs');
|
|
8
9
|
|
|
9
|
-
const SelectWalletChainLayout = ({ children, HeaderIcon }) =>
|
|
10
|
+
const SelectWalletChainLayout = ({ children, HeaderIcon }) => {
|
|
11
|
+
const { t } = reactI18next.useTranslation();
|
|
12
|
+
return (jsxRuntime.jsxs("div", { className: 'select-wallet-chain-layout__container', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { className: 'select-wallet-chain-layout__icon', Icon: HeaderIcon, iconSize: 96 }), jsxRuntime.jsxs("div", { className: 'select-wallet-chain-layout__body', children: [jsxRuntime.jsx(Typography.Typography, { className: 'select-wallet-chain-layout__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_chain.description', children: t('dyn_select_chain.description') }), jsxRuntime.jsx("div", { className: 'select-wallet-chain-layout__list', children: children })] })] }));
|
|
13
|
+
};
|
|
10
14
|
|
|
11
15
|
exports.SelectWalletChainLayout = SelectWalletChainLayout;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import { Typography } from '../Typography/Typography.js';
|
|
3
4
|
import { IconWithSpinner } from '../IconWithSpinner/IconWithSpinner.js';
|
|
4
5
|
|
|
5
|
-
const SelectWalletChainLayout = ({ children, HeaderIcon }) =>
|
|
6
|
+
const SelectWalletChainLayout = ({ children, HeaderIcon }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
return (jsxs("div", { className: 'select-wallet-chain-layout__container', children: [jsx(IconWithSpinner, { className: 'select-wallet-chain-layout__icon', Icon: HeaderIcon, iconSize: 96 }), jsxs("div", { className: 'select-wallet-chain-layout__body', children: [jsx(Typography, { className: 'select-wallet-chain-layout__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_chain.description', children: t('dyn_select_chain.description') }), jsx("div", { className: 'select-wallet-chain-layout__list', children: children })] })] }));
|
|
9
|
+
};
|
|
6
10
|
|
|
7
11
|
export { SelectWalletChainLayout };
|
|
@@ -111,6 +111,7 @@ var useSetShowAuthFlowWithInit = require('./hooks/useSetShowAuthFlowWithInit/use
|
|
|
111
111
|
var useShowPasskeyCreateSuccess = require('./hooks/useShowPasskeyCreateSuccess/useShowPasskeyCreateSuccess.cjs');
|
|
112
112
|
var useTieCallbacksToEvents = require('./hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs');
|
|
113
113
|
var useVerificationInProgress = require('./hooks/useVerificationInProgress/useVerificationInProgress.cjs');
|
|
114
|
+
var useSetShowLinkNewWalletModalWithInit = require('./hooks/useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.cjs');
|
|
114
115
|
var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
|
|
115
116
|
var useCustomerAuthFlowCallbacks = require('./useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs');
|
|
116
117
|
var validators = require('./validators.cjs');
|
|
@@ -164,7 +165,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
164
165
|
dynamicContextProps: { settings },
|
|
165
166
|
environmentId,
|
|
166
167
|
});
|
|
167
|
-
const { multiWallet, setMultiWallet } = useMultiWallet.useMultiWallet(
|
|
168
|
+
const { multiWallet, setMultiWallet } = useMultiWallet.useMultiWallet({
|
|
169
|
+
isBridgeFlow,
|
|
170
|
+
multiWalletSettings: (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.multiWallet,
|
|
171
|
+
toolkitEnabled: toolkitEnabled || false,
|
|
172
|
+
});
|
|
168
173
|
// for demo proposes when running single wallet
|
|
169
174
|
// it should not use bridge even having walletConnectV1Bridge set on settings
|
|
170
175
|
// but v2 if enabled
|
|
@@ -248,7 +253,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
248
253
|
const { didConnectedStateLoad, primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors.useWalletConnectors({
|
|
249
254
|
authMode,
|
|
250
255
|
authToken: getAuthToken.getAuthToken() || onboardingOnlyJwt,
|
|
251
|
-
canHaveMultipleWalletsConnected: multiWallet
|
|
256
|
+
canHaveMultipleWalletsConnected: multiWallet,
|
|
252
257
|
connectedWallets,
|
|
253
258
|
multiWalletWidgetState,
|
|
254
259
|
onboardingOnlyJwt,
|
|
@@ -271,11 +276,19 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
271
276
|
walletBook: walletBook$1,
|
|
272
277
|
});
|
|
273
278
|
const isRenderingEmbeddedAuthFlow = React.useRef(false);
|
|
279
|
+
const isUserAuthenticated = Boolean(authMode === 'connect-and-sign' ? user : isFullyConnected);
|
|
274
280
|
const setShowAuthFlowWithInit = useSetShowAuthFlowWithInit.useSetShowAuthFlowWithInit({
|
|
281
|
+
isAuthenticated: isUserAuthenticated,
|
|
282
|
+
isMultiWalletEnabled: multiWallet,
|
|
283
|
+
isRenderingEmbeddedAuthFlow,
|
|
284
|
+
setShowAuthFlow,
|
|
285
|
+
walletConnectorOptions,
|
|
286
|
+
});
|
|
287
|
+
const setShowLinkNewWalletModalWithInit = useSetShowLinkNewWalletModalWithInit.useSetShowLinkNewWalletModalWithInit({
|
|
288
|
+
isAuthenticated: isUserAuthenticated,
|
|
275
289
|
isMultiWalletEnabled: multiWallet,
|
|
276
290
|
isRenderingEmbeddedAuthFlow,
|
|
277
291
|
setShowAuthFlow,
|
|
278
|
-
user,
|
|
279
292
|
walletConnectorOptions,
|
|
280
293
|
});
|
|
281
294
|
const { getNameService, removeConnectedNameService } = useNameService.useNameService({
|
|
@@ -558,6 +571,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
558
571
|
setShowAuthFlow: setShowAuthFlowWithInit,
|
|
559
572
|
setShowBridgeWidget,
|
|
560
573
|
setShowDynamicUserProfile,
|
|
574
|
+
setShowLinkNewWalletModal: setShowLinkNewWalletModalWithInit,
|
|
561
575
|
setShowPasskeyCreatedSuccess,
|
|
562
576
|
setShowQrcodeModal,
|
|
563
577
|
setShowWidgetStatePopup,
|
|
@@ -664,6 +678,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
664
678
|
setSdkHasLoaded,
|
|
665
679
|
setSelectedWalletConnectorKey,
|
|
666
680
|
setShowAuthFlowWithInit,
|
|
681
|
+
setShowLinkNewWalletModalWithInit,
|
|
667
682
|
setShowPasskeyCreatedSuccess,
|
|
668
683
|
setShowQrcodeModal,
|
|
669
684
|
setUser,
|
|
@@ -107,6 +107,7 @@ import { useSetShowAuthFlowWithInit } from './hooks/useSetShowAuthFlowWithInit/u
|
|
|
107
107
|
import { useShowPasskeyCreateSuccess } from './hooks/useShowPasskeyCreateSuccess/useShowPasskeyCreateSuccess.js';
|
|
108
108
|
import { useTieCallbacksToEvents } from './hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js';
|
|
109
109
|
import { useVerificationInProgress } from './hooks/useVerificationInProgress/useVerificationInProgress.js';
|
|
110
|
+
import { useSetShowLinkNewWalletModalWithInit } from './hooks/useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.js';
|
|
110
111
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
111
112
|
import { useCustomerAuthFlowCallbacks } from './useCustomerCallbacks/useCustomerAuthFlowCallbacks.js';
|
|
112
113
|
import { validateAuthUser } from './validators.js';
|
|
@@ -160,7 +161,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
160
161
|
dynamicContextProps: { settings },
|
|
161
162
|
environmentId,
|
|
162
163
|
});
|
|
163
|
-
const { multiWallet, setMultiWallet } = useMultiWallet(
|
|
164
|
+
const { multiWallet, setMultiWallet } = useMultiWallet({
|
|
165
|
+
isBridgeFlow,
|
|
166
|
+
multiWalletSettings: (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.multiWallet,
|
|
167
|
+
toolkitEnabled: toolkitEnabled || false,
|
|
168
|
+
});
|
|
164
169
|
// for demo proposes when running single wallet
|
|
165
170
|
// it should not use bridge even having walletConnectV1Bridge set on settings
|
|
166
171
|
// but v2 if enabled
|
|
@@ -244,7 +249,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
244
249
|
const { didConnectedStateLoad, primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors({
|
|
245
250
|
authMode,
|
|
246
251
|
authToken: getAuthToken() || onboardingOnlyJwt,
|
|
247
|
-
canHaveMultipleWalletsConnected: multiWallet
|
|
252
|
+
canHaveMultipleWalletsConnected: multiWallet,
|
|
248
253
|
connectedWallets,
|
|
249
254
|
multiWalletWidgetState,
|
|
250
255
|
onboardingOnlyJwt,
|
|
@@ -267,11 +272,19 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
267
272
|
walletBook,
|
|
268
273
|
});
|
|
269
274
|
const isRenderingEmbeddedAuthFlow = useRef(false);
|
|
275
|
+
const isUserAuthenticated = Boolean(authMode === 'connect-and-sign' ? user : isFullyConnected);
|
|
270
276
|
const setShowAuthFlowWithInit = useSetShowAuthFlowWithInit({
|
|
277
|
+
isAuthenticated: isUserAuthenticated,
|
|
278
|
+
isMultiWalletEnabled: multiWallet,
|
|
279
|
+
isRenderingEmbeddedAuthFlow,
|
|
280
|
+
setShowAuthFlow,
|
|
281
|
+
walletConnectorOptions,
|
|
282
|
+
});
|
|
283
|
+
const setShowLinkNewWalletModalWithInit = useSetShowLinkNewWalletModalWithInit({
|
|
284
|
+
isAuthenticated: isUserAuthenticated,
|
|
271
285
|
isMultiWalletEnabled: multiWallet,
|
|
272
286
|
isRenderingEmbeddedAuthFlow,
|
|
273
287
|
setShowAuthFlow,
|
|
274
|
-
user,
|
|
275
288
|
walletConnectorOptions,
|
|
276
289
|
});
|
|
277
290
|
const { getNameService, removeConnectedNameService } = useNameService({
|
|
@@ -554,6 +567,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
554
567
|
setShowAuthFlow: setShowAuthFlowWithInit,
|
|
555
568
|
setShowBridgeWidget,
|
|
556
569
|
setShowDynamicUserProfile,
|
|
570
|
+
setShowLinkNewWalletModal: setShowLinkNewWalletModalWithInit,
|
|
557
571
|
setShowPasskeyCreatedSuccess,
|
|
558
572
|
setShowQrcodeModal,
|
|
559
573
|
setShowWidgetStatePopup,
|
|
@@ -660,6 +674,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
660
674
|
setSdkHasLoaded,
|
|
661
675
|
setSelectedWalletConnectorKey,
|
|
662
676
|
setShowAuthFlowWithInit,
|
|
677
|
+
setShowLinkNewWalletModalWithInit,
|
|
663
678
|
setShowPasskeyCreatedSuccess,
|
|
664
679
|
setShowQrcodeModal,
|
|
665
680
|
setUser,
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
+
require('@dynamic-labs/sdk-api');
|
|
7
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
8
|
+
require('@dynamic-labs/iconic');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('../../../ViewContext/ViewContext.cjs');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('../../../../utils/constants/colors.cjs');
|
|
14
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
15
|
+
require('viem');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../shared/consts/index.cjs');
|
|
6
18
|
|
|
7
19
|
/**
|
|
8
20
|
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
@@ -12,21 +24,31 @@ var React = require('react');
|
|
|
12
24
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
13
25
|
* to immediately trigger the deep link on mobile
|
|
14
26
|
*/
|
|
15
|
-
const useSetShowAuthFlowWithInit = ({
|
|
27
|
+
const useSetShowAuthFlowWithInit = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }) => {
|
|
16
28
|
const setShowAuthFlowWithInit = React.useCallback((value) => {
|
|
17
29
|
var _a;
|
|
18
30
|
if (value) {
|
|
19
|
-
// Do not change state if
|
|
20
|
-
|
|
21
|
-
// 2. An embedded auth flow is already being rendered
|
|
22
|
-
if ((user && !isMultiWalletEnabled) ||
|
|
23
|
-
isRenderingEmbeddedAuthFlow.current)
|
|
31
|
+
// Do not change state if an embedded auth flow is already being rendered
|
|
32
|
+
if (isRenderingEmbeddedAuthFlow.current)
|
|
24
33
|
return;
|
|
34
|
+
// show the user profile and log a warning is multi-wallet is disabled
|
|
35
|
+
// but the user is logged in this is done to prevent a broken looking state
|
|
36
|
+
if (isAuthenticated && !isMultiWalletEnabled) {
|
|
37
|
+
logger.logger.warn('setShowAuthFlow was called while the user is logged in, but Dynamic is not configured with multi-wallet enabled. This results in a no-op.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
25
40
|
(_a = walletConnectorOptions
|
|
26
41
|
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
42
|
+
logger.logger.warn('Using setShowAuthFlow to render the wallet list when the user is logged in is deprecated. Use setShowLinkNewWalletModal instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
27
43
|
}
|
|
28
44
|
setShowAuthFlow(value);
|
|
29
|
-
}, [
|
|
45
|
+
}, [
|
|
46
|
+
setShowAuthFlow,
|
|
47
|
+
isAuthenticated,
|
|
48
|
+
isMultiWalletEnabled,
|
|
49
|
+
isRenderingEmbeddedAuthFlow,
|
|
50
|
+
walletConnectorOptions,
|
|
51
|
+
]);
|
|
30
52
|
return setShowAuthFlowWithInit;
|
|
31
53
|
};
|
|
32
54
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WalletOption } from '../../../../shared';
|
|
3
3
|
import { IDynamicContext } from '../../types';
|
|
4
4
|
/**
|
|
5
5
|
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
@@ -9,10 +9,10 @@ import { IDynamicContext } from '../../types';
|
|
|
9
9
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
10
10
|
* to immediately trigger the deep link on mobile
|
|
11
11
|
*/
|
|
12
|
-
export declare const useSetShowAuthFlowWithInit: ({
|
|
12
|
+
export declare const useSetShowAuthFlowWithInit: ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }: {
|
|
13
13
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
14
|
+
isMultiWalletEnabled: boolean;
|
|
14
15
|
isRenderingEmbeddedAuthFlow: IDynamicContext['isRenderingEmbeddedAuthFlow'];
|
|
15
16
|
walletConnectorOptions: WalletOption[];
|
|
16
|
-
|
|
17
|
-
isMultiWalletEnabled?: boolean | undefined;
|
|
17
|
+
isAuthenticated: boolean;
|
|
18
18
|
}) => Dispatch<SetStateAction<boolean>>;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
+
import '@dynamic-labs/sdk-api';
|
|
3
|
+
import { logger } from '../../../../shared/logger.js';
|
|
4
|
+
import '@dynamic-labs/iconic';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../../ViewContext/ViewContext.js';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '../../../../utils/constants/colors.js';
|
|
10
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
11
|
+
import 'viem';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../shared/consts/index.js';
|
|
2
14
|
|
|
3
15
|
/**
|
|
4
16
|
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
@@ -8,21 +20,31 @@ import { useCallback } from 'react';
|
|
|
8
20
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
9
21
|
* to immediately trigger the deep link on mobile
|
|
10
22
|
*/
|
|
11
|
-
const useSetShowAuthFlowWithInit = ({
|
|
23
|
+
const useSetShowAuthFlowWithInit = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }) => {
|
|
12
24
|
const setShowAuthFlowWithInit = useCallback((value) => {
|
|
13
25
|
var _a;
|
|
14
26
|
if (value) {
|
|
15
|
-
// Do not change state if
|
|
16
|
-
|
|
17
|
-
// 2. An embedded auth flow is already being rendered
|
|
18
|
-
if ((user && !isMultiWalletEnabled) ||
|
|
19
|
-
isRenderingEmbeddedAuthFlow.current)
|
|
27
|
+
// Do not change state if an embedded auth flow is already being rendered
|
|
28
|
+
if (isRenderingEmbeddedAuthFlow.current)
|
|
20
29
|
return;
|
|
30
|
+
// show the user profile and log a warning is multi-wallet is disabled
|
|
31
|
+
// but the user is logged in this is done to prevent a broken looking state
|
|
32
|
+
if (isAuthenticated && !isMultiWalletEnabled) {
|
|
33
|
+
logger.warn('setShowAuthFlow was called while the user is logged in, but Dynamic is not configured with multi-wallet enabled. This results in a no-op.');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
21
36
|
(_a = walletConnectorOptions
|
|
22
37
|
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
38
|
+
logger.warn('Using setShowAuthFlow to render the wallet list when the user is logged in is deprecated. Use setShowLinkNewWalletModal instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
23
39
|
}
|
|
24
40
|
setShowAuthFlow(value);
|
|
25
|
-
}, [
|
|
41
|
+
}, [
|
|
42
|
+
setShowAuthFlow,
|
|
43
|
+
isAuthenticated,
|
|
44
|
+
isMultiWalletEnabled,
|
|
45
|
+
isRenderingEmbeddedAuthFlow,
|
|
46
|
+
walletConnectorOptions,
|
|
47
|
+
]);
|
|
26
48
|
return setShowAuthFlowWithInit;
|
|
27
49
|
};
|
|
28
50
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useSetShowLinkNewWalletModalWithInit';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
require('@dynamic-labs/sdk-api');
|
|
7
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
8
|
+
require('@dynamic-labs/iconic');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('../../../ViewContext/ViewContext.cjs');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('../../../../utils/constants/colors.cjs');
|
|
14
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
15
|
+
require('viem');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../shared/consts/index.cjs');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
21
|
+
* before we can connect a wallet. The goal here is that when a user clicks
|
|
22
|
+
* on the "Connect your wallet" button, the SDK starts initializing WalletConnect
|
|
23
|
+
* and will prime it for connection. This way, when the user clicks on the
|
|
24
|
+
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
25
|
+
* to immediately trigger the deep link on mobile
|
|
26
|
+
*/
|
|
27
|
+
const useSetShowLinkNewWalletModalWithInit = ({ setShowAuthFlow, walletConnectorOptions, isMultiWalletEnabled, isRenderingEmbeddedAuthFlow, isAuthenticated, }) => {
|
|
28
|
+
const setSetShowLinkNewWalletModalWithInit = React.useCallback((value) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (value) {
|
|
31
|
+
// Do not change state if:
|
|
32
|
+
// 1. The user is already signed in and multi-wallet is not enabled
|
|
33
|
+
// 2. An embedded auth flow is already being rendered
|
|
34
|
+
if (!isAuthenticated || isRenderingEmbeddedAuthFlow.current)
|
|
35
|
+
return;
|
|
36
|
+
if (!isMultiWalletEnabled) {
|
|
37
|
+
logger.logger.warn('setShowLinkNewWalletModal was called while the user was not logged in. This results in a no-op. To log the user in, use setShowAuthFlow. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
(_a = walletConnectorOptions
|
|
41
|
+
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
42
|
+
}
|
|
43
|
+
setShowAuthFlow(value);
|
|
44
|
+
}, [
|
|
45
|
+
setShowAuthFlow,
|
|
46
|
+
isAuthenticated,
|
|
47
|
+
isMultiWalletEnabled,
|
|
48
|
+
isRenderingEmbeddedAuthFlow,
|
|
49
|
+
walletConnectorOptions,
|
|
50
|
+
]);
|
|
51
|
+
return setSetShowLinkNewWalletModalWithInit;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.useSetShowLinkNewWalletModalWithInit = useSetShowLinkNewWalletModalWithInit;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { WalletOption } from '../../../../shared';
|
|
3
|
+
import { IDynamicContext } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
6
|
+
* before we can connect a wallet. The goal here is that when a user clicks
|
|
7
|
+
* on the "Connect your wallet" button, the SDK starts initializing WalletConnect
|
|
8
|
+
* and will prime it for connection. This way, when the user clicks on the
|
|
9
|
+
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
10
|
+
* to immediately trigger the deep link on mobile
|
|
11
|
+
*/
|
|
12
|
+
export declare const useSetShowLinkNewWalletModalWithInit: ({ setShowAuthFlow, walletConnectorOptions, isMultiWalletEnabled, isRenderingEmbeddedAuthFlow, isAuthenticated, }: {
|
|
13
|
+
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
14
|
+
isRenderingEmbeddedAuthFlow: IDynamicContext['isRenderingEmbeddedAuthFlow'];
|
|
15
|
+
walletConnectorOptions: WalletOption[];
|
|
16
|
+
isMultiWalletEnabled?: boolean | undefined;
|
|
17
|
+
isAuthenticated: boolean;
|
|
18
|
+
}) => Dispatch<SetStateAction<boolean>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import '@dynamic-labs/sdk-api';
|
|
3
|
+
import { logger } from '../../../../shared/logger.js';
|
|
4
|
+
import '@dynamic-labs/iconic';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../../ViewContext/ViewContext.js';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '../../../../utils/constants/colors.js';
|
|
10
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
11
|
+
import 'viem';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../shared/consts/index.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
17
|
+
* before we can connect a wallet. The goal here is that when a user clicks
|
|
18
|
+
* on the "Connect your wallet" button, the SDK starts initializing WalletConnect
|
|
19
|
+
* and will prime it for connection. This way, when the user clicks on the
|
|
20
|
+
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
21
|
+
* to immediately trigger the deep link on mobile
|
|
22
|
+
*/
|
|
23
|
+
const useSetShowLinkNewWalletModalWithInit = ({ setShowAuthFlow, walletConnectorOptions, isMultiWalletEnabled, isRenderingEmbeddedAuthFlow, isAuthenticated, }) => {
|
|
24
|
+
const setSetShowLinkNewWalletModalWithInit = useCallback((value) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (value) {
|
|
27
|
+
// Do not change state if:
|
|
28
|
+
// 1. The user is already signed in and multi-wallet is not enabled
|
|
29
|
+
// 2. An embedded auth flow is already being rendered
|
|
30
|
+
if (!isAuthenticated || isRenderingEmbeddedAuthFlow.current)
|
|
31
|
+
return;
|
|
32
|
+
if (!isMultiWalletEnabled) {
|
|
33
|
+
logger.warn('setShowLinkNewWalletModal was called while the user was not logged in. This results in a no-op. To log the user in, use setShowAuthFlow. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
(_a = walletConnectorOptions
|
|
37
|
+
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
38
|
+
}
|
|
39
|
+
setShowAuthFlow(value);
|
|
40
|
+
}, [
|
|
41
|
+
setShowAuthFlow,
|
|
42
|
+
isAuthenticated,
|
|
43
|
+
isMultiWalletEnabled,
|
|
44
|
+
isRenderingEmbeddedAuthFlow,
|
|
45
|
+
walletConnectorOptions,
|
|
46
|
+
]);
|
|
47
|
+
return setSetShowLinkNewWalletModalWithInit;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { useSetShowLinkNewWalletModalWithInit };
|
|
@@ -104,6 +104,7 @@ export interface IDynamicContext {
|
|
|
104
104
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
105
105
|
/** The unwrapped version of setShowAuthFlow. See useSetShowAuthFlowWithInit.ts for context */
|
|
106
106
|
internalSetShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
107
|
+
setShowLinkNewWalletModal: Dispatch<SetStateAction<boolean>>;
|
|
107
108
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
108
109
|
setShowPasskeyCreatedSuccess: VoidFunction;
|
|
109
110
|
setShowQrcodeModal: Dispatch<SetStateAction<boolean>>;
|
|
@@ -11,7 +11,7 @@ const useDynamicContext = () => {
|
|
|
11
11
|
if (context === undefined) {
|
|
12
12
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
13
13
|
}
|
|
14
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, } = context;
|
|
14
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, setShowLinkNewWalletModal, } = context;
|
|
15
15
|
return {
|
|
16
16
|
accountSwitchState,
|
|
17
17
|
authMode,
|
|
@@ -43,6 +43,7 @@ const useDynamicContext = () => {
|
|
|
43
43
|
setShowAuthFlow,
|
|
44
44
|
setShowBridgeWidget,
|
|
45
45
|
setShowDynamicUserProfile,
|
|
46
|
+
setShowLinkNewWalletModal,
|
|
46
47
|
setShowQrcodeModal,
|
|
47
48
|
shadowDOMEnabled,
|
|
48
49
|
showAuthFlow,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IDynamicContext } from './types';
|
|
2
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isFullyConnected' | 'isVerificationInProgress' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile'>;
|
|
2
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'isFullyConnected' | 'isVerificationInProgress' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setNetwork' | 'setPrimaryWallet' | 'setShowAuthFlow' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setShowLinkNewWalletModal'>;
|
|
3
3
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -7,7 +7,7 @@ const useDynamicContext = () => {
|
|
|
7
7
|
if (context === undefined) {
|
|
8
8
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
9
9
|
}
|
|
10
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, } = context;
|
|
10
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, isFullyConnected, isVerificationInProgress, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setNetwork, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, setShowLinkNewWalletModal, } = context;
|
|
11
11
|
return {
|
|
12
12
|
accountSwitchState,
|
|
13
13
|
authMode,
|
|
@@ -39,6 +39,7 @@ const useDynamicContext = () => {
|
|
|
39
39
|
setShowAuthFlow,
|
|
40
40
|
setShowBridgeWidget,
|
|
41
41
|
setShowDynamicUserProfile,
|
|
42
|
+
setShowLinkNewWalletModal,
|
|
42
43
|
setShowQrcodeModal,
|
|
43
44
|
shadowDOMEnabled,
|
|
44
45
|
showAuthFlow,
|