@dynamic-labs/sdk-react-core 0.18.100-viem.11 → 0.18.100-viem.13
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 +28 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/context/DynamicContext/DynamicContext.cjs +14 -5
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +11 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +14 -5
- package/src/lib/context/DynamicContext/helpers.cjs +2 -2
- package/src/lib/context/DynamicContext/helpers.d.ts +2 -1
- package/src/lib/context/DynamicContext/helpers.js +2 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +5 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +4 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +5 -2
- package/src/lib/context/DynamicContext/types/index.d.ts +3 -0
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/context/WalletContext/WalletContext.cjs +2 -16
- package/src/lib/context/WalletContext/WalletContext.js +2 -16
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +6 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +6 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +6 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +6 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -19
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -4
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +6 -10
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +6 -10
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +3 -1
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +3 -2
- package/src/lib/utils/hooks/useWallets/useWallets.js +3 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +3 -3
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +3 -3
- package/src/lib/views/viewToComponentMap.cjs +1 -0
- package/src/lib/views/viewToComponentMap.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +3 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +3 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.18.100-viem.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.12...v0.18.100-viem.13) (2023-09-01)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add option to disable the locked wallet view ([#3187](https://github.com/dynamic-labs/DynamicAuth/issues/3187)) ([aa70fb5](https://github.com/dynamic-labs/DynamicAuth/commit/aa70fb52bb185e27fdb311b0e0dd10166a83d60a))
|
|
8
|
+
* migrate starknet version to v5 ([#3198](https://github.com/dynamic-labs/DynamicAuth/issues/3198)) ([e5b24ea](https://github.com/dynamic-labs/DynamicAuth/commit/e5b24ea86ce58f83a539d8ef8adc6fb0c77bd51a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* show the multi wallet list when opening the auth flow to authenticated users ([#3165](https://github.com/dynamic-labs/DynamicAuth/issues/3165)) ([b7a7110](https://github.com/dynamic-labs/DynamicAuth/commit/b7a71106a730925dc44abbd0e3aedf5ce3f5ca39)), closes [#3134](https://github.com/dynamic-labs/DynamicAuth/issues/3134) [#3152](https://github.com/dynamic-labs/DynamicAuth/issues/3152) [#3168](https://github.com/dynamic-labs/DynamicAuth/issues/3168)
|
|
14
|
+
* sign message for embedded wallet when auth mode is connect only ([#3195](https://github.com/dynamic-labs/DynamicAuth/issues/3195)) ([6cdee66](https://github.com/dynamic-labs/DynamicAuth/commit/6cdee661d45877c3d78744d115a675d114d62091))
|
|
15
|
+
* verify email OTP when email is updated ([#3168](https://github.com/dynamic-labs/DynamicAuth/issues/3168)) ([641eeb6](https://github.com/dynamic-labs/DynamicAuth/commit/641eeb685b0c9d77cc72912f29b137c699c192f0))
|
|
16
|
+
|
|
17
|
+
### [0.18.100-viem.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.11...v0.18.100-viem.12) (2023-08-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add deepLinkPreference prop ([#3174](https://github.com/dynamic-labs/DynamicAuth/issues/3174)) ([#3177](https://github.com/dynamic-labs/DynamicAuth/issues/3177)) ([d5a4052](https://github.com/dynamic-labs/DynamicAuth/commit/d5a4052ce6547289fff08ba57728af227d334dfa))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* end connector session when unlinking from bridge ([#3120](https://github.com/dynamic-labs/DynamicAuth/issues/3120)) ([#3179](https://github.com/dynamic-labs/DynamicAuth/issues/3179)) ([d1f9898](https://github.com/dynamic-labs/DynamicAuth/commit/d1f9898fd678c9b342afe0dc1ea9ab21914c610f))
|
|
28
|
+
* **bridge:** update address when switching networks ([#3171](https://github.com/dynamic-labs/DynamicAuth/issues/3171)) ([#3181](https://github.com/dynamic-labs/DynamicAuth/issues/3181)) ([0e138e0](https://github.com/dynamic-labs/DynamicAuth/commit/0e138e0f824cda7e67f6ffce3057deb0a92ee7ae))
|
|
29
|
+
|
|
2
30
|
### [0.18.100-viem.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.100-viem.10...v0.18.100-viem.11) (2023-08-29)
|
|
3
31
|
|
|
4
32
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.18.100-viem.
|
|
3
|
+
"version": "0.18.100-viem.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
|
-
"@dynamic-labs/logger": "0.18.100-viem.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "0.18.100-viem.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "0.18.100-viem.
|
|
21
|
-
"@dynamic-labs/types": "0.18.100-viem.
|
|
22
|
-
"@dynamic-labs/utils": "0.18.100-viem.
|
|
23
|
-
"@dynamic-labs/wallet-book": "0.18.100-viem.
|
|
24
|
-
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.
|
|
18
|
+
"@dynamic-labs/logger": "0.18.100-viem.13",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "0.18.100-viem.13",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "0.18.100-viem.13",
|
|
21
|
+
"@dynamic-labs/types": "0.18.100-viem.13",
|
|
22
|
+
"@dynamic-labs/utils": "0.18.100-viem.13",
|
|
23
|
+
"@dynamic-labs/wallet-book": "0.18.100-viem.13",
|
|
24
|
+
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.13",
|
|
25
25
|
"eventemitter3": "5.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -101,7 +101,7 @@ const EMPTY_INITIAL_USER = undefined;
|
|
|
101
101
|
const DynamicContext = React.createContext(undefined);
|
|
102
102
|
const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
103
103
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
104
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, } = settings;
|
|
104
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, deepLinkPreference = 'native', walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = true, } = settings;
|
|
105
105
|
// The following event related methods are temporary and should be removed after QNTM-180 is done
|
|
106
106
|
// ============ START REMOVE AFTER QNTM-180 ============
|
|
107
107
|
const internalEventsRef = React.useRef(internalEvents.getInternalEvents());
|
|
@@ -174,6 +174,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
174
174
|
const { wallets } = useWallets.useWallets({
|
|
175
175
|
appLogoUrl,
|
|
176
176
|
appName,
|
|
177
|
+
deepLinkPreference,
|
|
177
178
|
flowNetwork,
|
|
178
179
|
networkConfigurations: serverNetworkConfigurations,
|
|
179
180
|
projectSettings,
|
|
@@ -234,7 +235,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
234
235
|
walletBook: walletBook$1,
|
|
235
236
|
});
|
|
236
237
|
const setShowAuthFlowWithInit = useSetShowAuthFlowWithInit.useSetShowAuthFlowWithInit({
|
|
238
|
+
isMultiWalletEnabled: multiWallet,
|
|
237
239
|
setShowAuthFlow,
|
|
240
|
+
user,
|
|
238
241
|
wallets,
|
|
239
242
|
});
|
|
240
243
|
// until user completes onboarding, jwt is only stored in onboardingOnlyJwt
|
|
@@ -451,6 +454,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
451
454
|
? unlinkConnectedWallet
|
|
452
455
|
: handleUnlinkWallet,
|
|
453
456
|
internalEvents: internalEventsRef,
|
|
457
|
+
internalSetShowAuthFlow: setShowAuthFlow,
|
|
454
458
|
isAuthenticated,
|
|
455
459
|
isBridgeFlow,
|
|
456
460
|
isFullyConnected,
|
|
@@ -513,6 +517,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
513
517
|
showAuthFlow,
|
|
514
518
|
showBridgeWidget,
|
|
515
519
|
showDynamicUserProfile,
|
|
520
|
+
showLockedWalletView,
|
|
516
521
|
showQrcodeModal,
|
|
517
522
|
showWidgetStatePopup,
|
|
518
523
|
signWithEmailWalletName,
|
|
@@ -567,13 +572,12 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
567
572
|
handleUnlinkWallet,
|
|
568
573
|
isAuthenticated,
|
|
569
574
|
isBridgeFlow,
|
|
575
|
+
isFullyConnected,
|
|
570
576
|
isProjectSettingsLoading,
|
|
571
577
|
isSingleWalletAccount,
|
|
572
|
-
isFullyConnected,
|
|
573
578
|
isVerificationInProgress,
|
|
574
|
-
primaryWallet,
|
|
575
|
-
secondaryWallets,
|
|
576
579
|
legacyIsVerifying,
|
|
580
|
+
linkedWallets,
|
|
577
581
|
loadingNetwork,
|
|
578
582
|
loginWithEmail,
|
|
579
583
|
multiWallet,
|
|
@@ -586,6 +590,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
586
590
|
imageUserInAccessList,
|
|
587
591
|
onboardingImageUrl,
|
|
588
592
|
policiesConsentInnerComponent,
|
|
593
|
+
primaryWallet,
|
|
589
594
|
primaryWalletId,
|
|
590
595
|
privacyPolicyUrl,
|
|
591
596
|
projectSettings,
|
|
@@ -593,12 +598,15 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
593
598
|
removeConnectedWalletsInfo,
|
|
594
599
|
rpcProviders,
|
|
595
600
|
sdkHasLoaded,
|
|
601
|
+
secondaryWallets,
|
|
596
602
|
selectedWalletConnector,
|
|
597
603
|
selectedWalletWithAction,
|
|
604
|
+
sendWagmiSettings,
|
|
598
605
|
setAuthMode,
|
|
599
606
|
setAuthorizationViewDisplayOrder,
|
|
600
607
|
setCallback,
|
|
601
608
|
setIsFullyConnected,
|
|
609
|
+
setIsVerificationInProgress,
|
|
602
610
|
setLogInWithEmail,
|
|
603
611
|
setMultiWallet,
|
|
604
612
|
setMultiWalletWidgetState,
|
|
@@ -613,6 +621,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
613
621
|
showAuthFlow,
|
|
614
622
|
showBridgeWidget,
|
|
615
623
|
showDynamicUserProfile,
|
|
624
|
+
showLockedWalletView,
|
|
616
625
|
showQrcodeModal,
|
|
617
626
|
showWidgetStatePopup,
|
|
618
627
|
signWithEmailWalletName,
|
|
@@ -630,7 +639,6 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
630
639
|
walletsByChain,
|
|
631
640
|
walletsFilter,
|
|
632
641
|
walletsToConnectByChain,
|
|
633
|
-
linkedWallets,
|
|
634
642
|
]);
|
|
635
643
|
React.useEffect(() => {
|
|
636
644
|
const addPrefetch = (attr) => {
|
|
@@ -678,6 +686,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
678
686
|
connectedWallets,
|
|
679
687
|
isBridgeFlow,
|
|
680
688
|
isFullyConnected,
|
|
689
|
+
isMultiWalletEnabled: multiWallet,
|
|
681
690
|
loginWithEmail,
|
|
682
691
|
}), children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(QrCodeContext.QrCodeContextProvider, { children: jsxRuntime.jsx(EmailVerificationContext.EmailVerificationContextProvider, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsxs(WalletGroupContext.WalletGroupContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(OAuthIFrameContainer.OAuthIFrameContainer, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
683
692
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { LogLevel } from '@dynamic-labs/logger';
|
|
3
3
|
import { EvmNetwork, SocialProviderFilter } from '@dynamic-labs/types';
|
|
4
|
-
import { WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { DeepLinkVariant, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { AccessDeniedCustomButton, AuthModeType, ChainToWalletMap, DynamicEventsCallbacks, WalletOption } from '../../shared';
|
|
6
6
|
import { SocialNetworkIconType } from '../../utils/functions/getSocialNetworkIcon';
|
|
7
7
|
import { ThemeData, ThemeSetting } from '../ThemeContext';
|
|
@@ -19,6 +19,15 @@ export interface DynamicContextProps {
|
|
|
19
19
|
appName?: string;
|
|
20
20
|
cssOverrides?: string | JSX.Element;
|
|
21
21
|
debugError?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Used to control the type of deep link used when connecting
|
|
24
|
+
* a mobile wallet. Defaults to 'native'. This is useful for
|
|
25
|
+
* example if your app is running in a webview of a native
|
|
26
|
+
* mobile app, and you want to be able to link out to any
|
|
27
|
+
* wallet without having to modify your iOS build config.
|
|
28
|
+
* In this case, you can set this to 'universal'.
|
|
29
|
+
*/
|
|
30
|
+
deepLinkPreference?: DeepLinkVariant;
|
|
22
31
|
defaultNumberOfWalletsToShow?: number;
|
|
23
32
|
displaySiweStatement?: boolean;
|
|
24
33
|
enableVisitTrackingOnConnectOnly?: boolean;
|
|
@@ -36,6 +45,7 @@ export interface DynamicContextProps {
|
|
|
36
45
|
* @default WARN
|
|
37
46
|
*/
|
|
38
47
|
logLevel?: keyof typeof LogLevel;
|
|
48
|
+
showLockedWalletView?: boolean;
|
|
39
49
|
newToWeb3WalletChainMap?: ChainToWalletMap;
|
|
40
50
|
notInTheListImageUrl?: string;
|
|
41
51
|
onboardingImageUrl?: string;
|
|
@@ -97,7 +97,7 @@ const EMPTY_INITIAL_USER = undefined;
|
|
|
97
97
|
const DynamicContext = createContext(undefined);
|
|
98
98
|
const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
99
99
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
100
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, } = settings;
|
|
100
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, deepLinkPreference = 'native', walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = true, } = settings;
|
|
101
101
|
// The following event related methods are temporary and should be removed after QNTM-180 is done
|
|
102
102
|
// ============ START REMOVE AFTER QNTM-180 ============
|
|
103
103
|
const internalEventsRef = useRef(getInternalEvents());
|
|
@@ -170,6 +170,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
170
170
|
const { wallets } = useWallets({
|
|
171
171
|
appLogoUrl,
|
|
172
172
|
appName,
|
|
173
|
+
deepLinkPreference,
|
|
173
174
|
flowNetwork,
|
|
174
175
|
networkConfigurations: serverNetworkConfigurations,
|
|
175
176
|
projectSettings,
|
|
@@ -230,7 +231,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
230
231
|
walletBook,
|
|
231
232
|
});
|
|
232
233
|
const setShowAuthFlowWithInit = useSetShowAuthFlowWithInit({
|
|
234
|
+
isMultiWalletEnabled: multiWallet,
|
|
233
235
|
setShowAuthFlow,
|
|
236
|
+
user,
|
|
234
237
|
wallets,
|
|
235
238
|
});
|
|
236
239
|
// until user completes onboarding, jwt is only stored in onboardingOnlyJwt
|
|
@@ -447,6 +450,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
447
450
|
? unlinkConnectedWallet
|
|
448
451
|
: handleUnlinkWallet,
|
|
449
452
|
internalEvents: internalEventsRef,
|
|
453
|
+
internalSetShowAuthFlow: setShowAuthFlow,
|
|
450
454
|
isAuthenticated,
|
|
451
455
|
isBridgeFlow,
|
|
452
456
|
isFullyConnected,
|
|
@@ -509,6 +513,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
509
513
|
showAuthFlow,
|
|
510
514
|
showBridgeWidget,
|
|
511
515
|
showDynamicUserProfile,
|
|
516
|
+
showLockedWalletView,
|
|
512
517
|
showQrcodeModal,
|
|
513
518
|
showWidgetStatePopup,
|
|
514
519
|
signWithEmailWalletName,
|
|
@@ -563,13 +568,12 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
563
568
|
handleUnlinkWallet,
|
|
564
569
|
isAuthenticated,
|
|
565
570
|
isBridgeFlow,
|
|
571
|
+
isFullyConnected,
|
|
566
572
|
isProjectSettingsLoading,
|
|
567
573
|
isSingleWalletAccount,
|
|
568
|
-
isFullyConnected,
|
|
569
574
|
isVerificationInProgress,
|
|
570
|
-
primaryWallet,
|
|
571
|
-
secondaryWallets,
|
|
572
575
|
legacyIsVerifying,
|
|
576
|
+
linkedWallets,
|
|
573
577
|
loadingNetwork,
|
|
574
578
|
loginWithEmail,
|
|
575
579
|
multiWallet,
|
|
@@ -582,6 +586,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
582
586
|
imageUserInAccessList,
|
|
583
587
|
onboardingImageUrl,
|
|
584
588
|
policiesConsentInnerComponent,
|
|
589
|
+
primaryWallet,
|
|
585
590
|
primaryWalletId,
|
|
586
591
|
privacyPolicyUrl,
|
|
587
592
|
projectSettings,
|
|
@@ -589,12 +594,15 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
589
594
|
removeConnectedWalletsInfo,
|
|
590
595
|
rpcProviders,
|
|
591
596
|
sdkHasLoaded,
|
|
597
|
+
secondaryWallets,
|
|
592
598
|
selectedWalletConnector,
|
|
593
599
|
selectedWalletWithAction,
|
|
600
|
+
sendWagmiSettings,
|
|
594
601
|
setAuthMode,
|
|
595
602
|
setAuthorizationViewDisplayOrder,
|
|
596
603
|
setCallback,
|
|
597
604
|
setIsFullyConnected,
|
|
605
|
+
setIsVerificationInProgress,
|
|
598
606
|
setLogInWithEmail,
|
|
599
607
|
setMultiWallet,
|
|
600
608
|
setMultiWalletWidgetState,
|
|
@@ -609,6 +617,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
609
617
|
showAuthFlow,
|
|
610
618
|
showBridgeWidget,
|
|
611
619
|
showDynamicUserProfile,
|
|
620
|
+
showLockedWalletView,
|
|
612
621
|
showQrcodeModal,
|
|
613
622
|
showWidgetStatePopup,
|
|
614
623
|
signWithEmailWalletName,
|
|
@@ -626,7 +635,6 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
626
635
|
walletsByChain,
|
|
627
636
|
walletsFilter,
|
|
628
637
|
walletsToConnectByChain,
|
|
629
|
-
linkedWallets,
|
|
630
638
|
]);
|
|
631
639
|
useEffect(() => {
|
|
632
640
|
const addPrefetch = (attr) => {
|
|
@@ -674,6 +682,7 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
674
682
|
connectedWallets,
|
|
675
683
|
isBridgeFlow,
|
|
676
684
|
isFullyConnected,
|
|
685
|
+
isMultiWalletEnabled: multiWallet,
|
|
677
686
|
loginWithEmail,
|
|
678
687
|
}), children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(QrCodeContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(ErrorContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(CaptchaContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsxs(WalletGroupContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(OAuthIFrameContainer, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
679
688
|
};
|
|
@@ -54,12 +54,12 @@ const initExpirationTime = (logout) => {
|
|
|
54
54
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
55
55
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
56
56
|
};
|
|
57
|
-
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }) => {
|
|
57
|
+
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, isMultiWalletEnabled, }) => {
|
|
58
58
|
if (loginWithEmail) {
|
|
59
59
|
return 'login-with-email-or-wallet';
|
|
60
60
|
}
|
|
61
61
|
if (isFullyConnected) {
|
|
62
|
-
return 'wallet-list';
|
|
62
|
+
return isMultiWalletEnabled ? 'multi-wallet-wallet-list' : 'wallet-list';
|
|
63
63
|
}
|
|
64
64
|
if (isBridgeFlow && !connectedWallets.length) {
|
|
65
65
|
return 'bridge-welcome';
|
|
@@ -2,9 +2,10 @@ import { Wallet } from '../../shared';
|
|
|
2
2
|
import { ViewType } from '../ViewContext';
|
|
3
3
|
export declare const isAuthTokenExpired: (token: string) => boolean;
|
|
4
4
|
export declare const initExpirationTime: (logout: VoidFunction) => void;
|
|
5
|
-
export declare const getInitialView: ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }: {
|
|
5
|
+
export declare const getInitialView: ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, isMultiWalletEnabled, }: {
|
|
6
6
|
connectedWallets: Wallet[];
|
|
7
7
|
loginWithEmail: boolean;
|
|
8
8
|
isBridgeFlow: boolean;
|
|
9
9
|
isFullyConnected: boolean;
|
|
10
|
+
isMultiWalletEnabled: boolean;
|
|
10
11
|
}) => ViewType;
|
|
@@ -50,12 +50,12 @@ const initExpirationTime = (logout) => {
|
|
|
50
50
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
51
51
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
52
52
|
};
|
|
53
|
-
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, }) => {
|
|
53
|
+
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isFullyConnected, isMultiWalletEnabled, }) => {
|
|
54
54
|
if (loginWithEmail) {
|
|
55
55
|
return 'login-with-email-or-wallet';
|
|
56
56
|
}
|
|
57
57
|
if (isFullyConnected) {
|
|
58
|
-
return 'wallet-list';
|
|
58
|
+
return isMultiWalletEnabled ? 'multi-wallet-wallet-list' : 'wallet-list';
|
|
59
59
|
}
|
|
60
60
|
if (isBridgeFlow && !connectedWallets.length) {
|
|
61
61
|
return 'bridge-welcome';
|
|
@@ -12,15 +12,18 @@ var React = require('react');
|
|
|
12
12
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
13
13
|
* to immediately trigger the deep link on mobile
|
|
14
14
|
*/
|
|
15
|
-
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, wallets, }) => {
|
|
15
|
+
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, wallets, user, isMultiWalletEnabled, }) => {
|
|
16
16
|
const setShowAuthFlowWithInit = React.useCallback((value) => {
|
|
17
17
|
var _a;
|
|
18
18
|
if (value) {
|
|
19
|
+
// if the uer is already signed in but multiwallet is not enabled, do not change state
|
|
20
|
+
if (user && !isMultiWalletEnabled)
|
|
21
|
+
return;
|
|
19
22
|
(_a = wallets
|
|
20
23
|
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
21
24
|
}
|
|
22
25
|
setShowAuthFlow(value);
|
|
23
|
-
}, [setShowAuthFlow, wallets]);
|
|
26
|
+
}, [setShowAuthFlow, wallets, user, isMultiWalletEnabled]);
|
|
24
27
|
return setShowAuthFlowWithInit;
|
|
25
28
|
};
|
|
26
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { WalletOption } from '../../../../shared';
|
|
2
|
+
import { UserProfile, WalletOption } from '../../../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
|
|
5
5
|
* before we can connect a wallet. The goal here is that when a user clicks
|
|
@@ -8,7 +8,9 @@ import { WalletOption } from '../../../../shared';
|
|
|
8
8
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
9
9
|
* to immediately trigger the deep link on mobile
|
|
10
10
|
*/
|
|
11
|
-
export declare const useSetShowAuthFlowWithInit: ({ setShowAuthFlow, wallets, }: {
|
|
11
|
+
export declare const useSetShowAuthFlowWithInit: ({ setShowAuthFlow, wallets, user, isMultiWalletEnabled, }: {
|
|
12
12
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
13
13
|
wallets: WalletOption[];
|
|
14
|
+
user?: UserProfile | undefined;
|
|
15
|
+
isMultiWalletEnabled?: boolean | undefined;
|
|
14
16
|
}) => Dispatch<SetStateAction<boolean>>;
|
|
@@ -8,15 +8,18 @@ import { useCallback } from 'react';
|
|
|
8
8
|
* "Connect" button in the WalletConnect modal, there is a uri ready to go
|
|
9
9
|
* to immediately trigger the deep link on mobile
|
|
10
10
|
*/
|
|
11
|
-
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, wallets, }) => {
|
|
11
|
+
const useSetShowAuthFlowWithInit = ({ setShowAuthFlow, wallets, user, isMultiWalletEnabled, }) => {
|
|
12
12
|
const setShowAuthFlowWithInit = useCallback((value) => {
|
|
13
13
|
var _a;
|
|
14
14
|
if (value) {
|
|
15
|
+
// if the uer is already signed in but multiwallet is not enabled, do not change state
|
|
16
|
+
if (user && !isMultiWalletEnabled)
|
|
17
|
+
return;
|
|
15
18
|
(_a = wallets
|
|
16
19
|
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
17
20
|
}
|
|
18
21
|
setShowAuthFlow(value);
|
|
19
|
-
}, [setShowAuthFlow, wallets]);
|
|
22
|
+
}, [setShowAuthFlow, wallets, user, isMultiWalletEnabled]);
|
|
20
23
|
return setShowAuthFlowWithInit;
|
|
21
24
|
};
|
|
22
25
|
|
|
@@ -98,6 +98,8 @@ export interface IDynamicContext {
|
|
|
98
98
|
setSelectedWalletConnector: (connector: WalletConnector | null) => void;
|
|
99
99
|
setSelectedWalletWithAction: (walletWithAction: WalletWithAction | null) => void;
|
|
100
100
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
101
|
+
/** The unwrapped version of setShowAuthFlow. See useSetShowAuthFlowWithInit.ts for context */
|
|
102
|
+
internalSetShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
101
103
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
102
104
|
setShowQrcodeModal: Dispatch<SetStateAction<boolean>>;
|
|
103
105
|
setShowWidgetStatePopup: Dispatch<SetStateAction<boolean>>;
|
|
@@ -113,6 +115,7 @@ export interface IDynamicContext {
|
|
|
113
115
|
* The boolean value representing the state of displaying the bridge widget
|
|
114
116
|
*/
|
|
115
117
|
showBridgeWidget: boolean;
|
|
118
|
+
showLockedWalletView?: boolean;
|
|
116
119
|
showQrcodeModal: boolean;
|
|
117
120
|
showWidgetStatePopup: boolean;
|
|
118
121
|
signWithEmailWalletName?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SetStateAction, Dispatch, PropsWithChildren, FC } from 'react';
|
|
2
|
-
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts';
|
|
2
|
+
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts';
|
|
3
3
|
export type ViewContextProps = {
|
|
4
4
|
setView: Dispatch<SetStateAction<ViewType>>;
|
|
5
5
|
view: ViewType;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
|
|
7
|
+
require('../DynamicContext/DynamicContext.cjs');
|
|
8
8
|
require('@dynamic-labs/sdk-api');
|
|
9
9
|
require('../../shared/logger.cjs');
|
|
10
10
|
require('@dynamic-labs/iconic');
|
|
@@ -26,21 +26,7 @@ var useSyncPrimaryWallet = require('../../utils/hooks/multiWallet/useSyncPrimary
|
|
|
26
26
|
|
|
27
27
|
const WalletContext = React.createContext(undefined);
|
|
28
28
|
const WalletContextProvider = ({ children, canSync, }) => {
|
|
29
|
-
|
|
30
|
-
useSyncPrimaryWallet.useSyncPrimaryWallet({
|
|
31
|
-
authMode,
|
|
32
|
-
canSync,
|
|
33
|
-
computeConnectedStateForWallets,
|
|
34
|
-
connectWallet,
|
|
35
|
-
handleLogOut,
|
|
36
|
-
multiWalletWidgetState,
|
|
37
|
-
primaryWallet,
|
|
38
|
-
secondaryWallets,
|
|
39
|
-
setMultiWalletWidgetState,
|
|
40
|
-
setPrimaryWallet,
|
|
41
|
-
setShowWidgetStatePopup,
|
|
42
|
-
showWidgetStatePopup,
|
|
43
|
-
});
|
|
29
|
+
useSyncPrimaryWallet.useSyncPrimaryWallet(canSync);
|
|
44
30
|
const value = undefined;
|
|
45
31
|
return (jsxRuntime.jsx(WalletContext.Provider, { value: value, children: children }));
|
|
46
32
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import '../DynamicContext/DynamicContext.js';
|
|
4
4
|
import '@dynamic-labs/sdk-api';
|
|
5
5
|
import '../../shared/logger.js';
|
|
6
6
|
import '@dynamic-labs/iconic';
|
|
@@ -22,21 +22,7 @@ import { useSyncPrimaryWallet } from '../../utils/hooks/multiWallet/useSyncPrima
|
|
|
22
22
|
|
|
23
23
|
const WalletContext = createContext(undefined);
|
|
24
24
|
const WalletContextProvider = ({ children, canSync, }) => {
|
|
25
|
-
|
|
26
|
-
useSyncPrimaryWallet({
|
|
27
|
-
authMode,
|
|
28
|
-
canSync,
|
|
29
|
-
computeConnectedStateForWallets,
|
|
30
|
-
connectWallet,
|
|
31
|
-
handleLogOut,
|
|
32
|
-
multiWalletWidgetState,
|
|
33
|
-
primaryWallet,
|
|
34
|
-
secondaryWallets,
|
|
35
|
-
setMultiWalletWidgetState,
|
|
36
|
-
setPrimaryWallet,
|
|
37
|
-
setShowWidgetStatePopup,
|
|
38
|
-
showWidgetStatePopup,
|
|
39
|
-
});
|
|
25
|
+
useSyncPrimaryWallet(canSync);
|
|
40
26
|
const value = undefined;
|
|
41
27
|
return (jsx(WalletContext.Provider, { value: value, children: children }));
|
|
42
28
|
};
|
|
@@ -44,10 +44,15 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
44
44
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
45
45
|
heading: 'Select your wallet',
|
|
46
46
|
},
|
|
47
|
+
'multi-wallet-wallet-list': {
|
|
48
|
+
heading: 'Link a new wallet',
|
|
49
|
+
},
|
|
47
50
|
'wallet-connect-mobile-wallets-list': {
|
|
48
51
|
heading: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(iconic.WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', "WalletConnect wallets"] })),
|
|
49
52
|
},
|
|
50
|
-
'wallet-list': {
|
|
53
|
+
'wallet-list': {
|
|
54
|
+
heading: 'Select your wallet',
|
|
55
|
+
},
|
|
51
56
|
'wallet-sign': { heading: 'Sign to confirm transfer' },
|
|
52
57
|
};
|
|
53
58
|
const helpHeaderData = helpHeaderMap[view];
|
|
@@ -40,10 +40,15 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
40
40
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
41
41
|
heading: 'Select your wallet',
|
|
42
42
|
},
|
|
43
|
+
'multi-wallet-wallet-list': {
|
|
44
|
+
heading: 'Link a new wallet',
|
|
45
|
+
},
|
|
43
46
|
'wallet-connect-mobile-wallets-list': {
|
|
44
47
|
heading: (jsxs(Fragment, { children: [jsx(WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', "WalletConnect wallets"] })),
|
|
45
48
|
},
|
|
46
|
-
'wallet-list': {
|
|
49
|
+
'wallet-list': {
|
|
50
|
+
heading: 'Select your wallet',
|
|
51
|
+
},
|
|
47
52
|
'wallet-sign': { heading: 'Sign to confirm transfer' },
|
|
48
53
|
};
|
|
49
54
|
const helpHeaderData = helpHeaderMap[view];
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
7
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
7
8
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
8
9
|
var ErrorContext = require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -10,7 +11,6 @@ var useVerifyWallet = require('../../useVerifyWallet/useVerifyWallet.cjs');
|
|
|
10
11
|
require('@dynamic-labs/sdk-api');
|
|
11
12
|
var logger = require('../../../../shared/logger.cjs');
|
|
12
13
|
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
14
|
require('react/jsx-runtime');
|
|
15
15
|
require('react');
|
|
16
16
|
require('@dynamic-labs/wallet-book');
|
|
@@ -23,7 +23,7 @@ require('../../../../shared/consts/index.cjs');
|
|
|
23
23
|
const useSignConnectOnlyUser = () => {
|
|
24
24
|
const { setView } = ViewContext.useViewContext();
|
|
25
25
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
26
|
-
const { connectWallet, consumeNonce, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
26
|
+
const { connectWallet, consumeNonce, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnector, walletUiUtils, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
27
27
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
28
28
|
consumeNonce,
|
|
29
29
|
displaySiweStatement,
|
|
@@ -33,6 +33,10 @@ const useSignConnectOnlyUser = () => {
|
|
|
33
33
|
});
|
|
34
34
|
return ({ walletConnector, fetchPublicAddressOpts = undefined, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
35
|
try {
|
|
36
|
+
if (walletConnectorCore.isEmbeddedConnector(walletConnector) &&
|
|
37
|
+
!walletConnectorCore.isBloctoConnector(walletConnector)) {
|
|
38
|
+
walletUiUtils.disabledConfirmationOnce();
|
|
39
|
+
}
|
|
36
40
|
// Prepare states to show the pending signature view (without back button)
|
|
37
41
|
// We need this because in connect-only we don't want to show wallet-list
|
|
38
42
|
// We don't want to show the back button in the pending signature view
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { isEmbeddedConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
3
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
3
4
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
4
5
|
import { useErrorContext } from '../../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -6,7 +7,6 @@ import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
|
6
7
|
import '@dynamic-labs/sdk-api';
|
|
7
8
|
import { logger } from '../../../../shared/logger.js';
|
|
8
9
|
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import 'react';
|
|
12
12
|
import '@dynamic-labs/wallet-book';
|
|
@@ -19,7 +19,7 @@ import '../../../../shared/consts/index.js';
|
|
|
19
19
|
const useSignConnectOnlyUser = () => {
|
|
20
20
|
const { setView } = useViewContext();
|
|
21
21
|
const { setErrorMessage } = useErrorContext();
|
|
22
|
-
const { connectWallet, consumeNonce, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnector, } = useInternalDynamicContext();
|
|
22
|
+
const { connectWallet, consumeNonce, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnector, walletUiUtils, } = useInternalDynamicContext();
|
|
23
23
|
const verifyWallet = useVerifyWallet({
|
|
24
24
|
consumeNonce,
|
|
25
25
|
displaySiweStatement,
|
|
@@ -29,6 +29,10 @@ const useSignConnectOnlyUser = () => {
|
|
|
29
29
|
});
|
|
30
30
|
return ({ walletConnector, fetchPublicAddressOpts = undefined, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
try {
|
|
32
|
+
if (isEmbeddedConnector(walletConnector) &&
|
|
33
|
+
!isBloctoConnector(walletConnector)) {
|
|
34
|
+
walletUiUtils.disabledConfirmationOnce();
|
|
35
|
+
}
|
|
32
36
|
// Prepare states to show the pending signature view (without back button)
|
|
33
37
|
// We need this because in connect-only we don't want to show wallet-list
|
|
34
38
|
// We don't want to show the back button in the pending signature view
|
|
@@ -10,8 +10,8 @@ var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
|
10
10
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
11
11
|
var errors = require('../../../constants/errors.cjs');
|
|
12
12
|
|
|
13
|
-
const useSyncPrimaryWallet = (
|
|
14
|
-
const { setShowAuthFlow, isAuthenticated } = useInternalDynamicContext.useInternalDynamicContext();
|
|
13
|
+
const useSyncPrimaryWallet = (canSync = true) => {
|
|
14
|
+
const { setShowAuthFlow, isAuthenticated, authMode, computeConnectedStateForWallets, connectWallet, handleLogOut, multiWalletWidgetState, primaryWallet, secondaryWallets, setMultiWalletWidgetState, setPrimaryWallet, setShowWidgetStatePopup, showLockedWalletView, showWidgetStatePopup, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
15
15
|
const { setView } = ViewContext.useViewContext();
|
|
16
16
|
const handlePrimaryWalletNotActive = React.useCallback((connectedAddress) => {
|
|
17
17
|
if (!primaryWallet)
|
|
@@ -97,8 +97,12 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
97
97
|
handleLogOut();
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if (showLockedWalletView) {
|
|
101
|
+
setShowAuthFlow(true);
|
|
102
|
+
setView('wallet-locked-view');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
handleLogOut();
|
|
102
106
|
}
|
|
103
107
|
});
|
|
104
108
|
}, [
|
|
@@ -115,6 +119,7 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
115
119
|
setShowAuthFlow,
|
|
116
120
|
authMode,
|
|
117
121
|
isAuthenticated,
|
|
122
|
+
showLockedWalletView,
|
|
118
123
|
]);
|
|
119
124
|
};
|
|
120
125
|
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { FetchPublicAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import { AuthModeType, MultiWalletWidgetState, Wallet } from '../../../../shared/types';
|
|
4
|
-
import { MultiWalletWidgetStateSetter } from '../useMultiWalletWidgetState';
|
|
5
|
-
export type UseSyncPrimaryWalletArgs = {
|
|
6
|
-
canSync?: boolean;
|
|
7
|
-
connectWallet: (walletConnector: WalletConnector, fetchPublicAddressOpts?: FetchPublicAddressOpts, shouldCallCallback?: boolean) => Promise<string | undefined>;
|
|
8
|
-
computeConnectedStateForWallets: () => Promise<void>;
|
|
9
|
-
handleLogOut: () => Promise<void>;
|
|
10
|
-
multiWalletWidgetState: MultiWalletWidgetState;
|
|
11
|
-
primaryWallet: Wallet | null;
|
|
12
|
-
secondaryWallets: Wallet[];
|
|
13
|
-
setMultiWalletWidgetState: MultiWalletWidgetStateSetter;
|
|
14
|
-
setPrimaryWallet: (walletId: string) => Promise<void>;
|
|
15
|
-
setShowWidgetStatePopup: Dispatch<SetStateAction<boolean>>;
|
|
16
|
-
showWidgetStatePopup: boolean;
|
|
17
|
-
authMode: AuthModeType;
|
|
18
|
-
};
|
|
19
|
-
export declare const useSyncPrimaryWallet: ({ connectWallet, computeConnectedStateForWallets, handleLogOut, multiWalletWidgetState, primaryWallet, secondaryWallets, setMultiWalletWidgetState, setPrimaryWallet, setShowWidgetStatePopup, showWidgetStatePopup, canSync, authMode, }: UseSyncPrimaryWalletArgs) => void;
|
|
1
|
+
export declare const useSyncPrimaryWallet: (canSync?: boolean) => void;
|
|
@@ -6,8 +6,8 @@ import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
|
6
6
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
7
7
|
import { MISSING_ADDRESS_ERROR } from '../../../constants/errors.js';
|
|
8
8
|
|
|
9
|
-
const useSyncPrimaryWallet = (
|
|
10
|
-
const { setShowAuthFlow, isAuthenticated } = useInternalDynamicContext();
|
|
9
|
+
const useSyncPrimaryWallet = (canSync = true) => {
|
|
10
|
+
const { setShowAuthFlow, isAuthenticated, authMode, computeConnectedStateForWallets, connectWallet, handleLogOut, multiWalletWidgetState, primaryWallet, secondaryWallets, setMultiWalletWidgetState, setPrimaryWallet, setShowWidgetStatePopup, showLockedWalletView, showWidgetStatePopup, } = useInternalDynamicContext();
|
|
11
11
|
const { setView } = useViewContext();
|
|
12
12
|
const handlePrimaryWalletNotActive = useCallback((connectedAddress) => {
|
|
13
13
|
if (!primaryWallet)
|
|
@@ -93,8 +93,12 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
93
93
|
handleLogOut();
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
if (showLockedWalletView) {
|
|
97
|
+
setShowAuthFlow(true);
|
|
98
|
+
setView('wallet-locked-view');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
handleLogOut();
|
|
98
102
|
}
|
|
99
103
|
});
|
|
100
104
|
}, [
|
|
@@ -111,6 +115,7 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
111
115
|
setShowAuthFlow,
|
|
112
116
|
authMode,
|
|
113
117
|
isAuthenticated,
|
|
118
|
+
showLockedWalletView,
|
|
114
119
|
]);
|
|
115
120
|
};
|
|
116
121
|
|
|
@@ -47,12 +47,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
47
47
|
const walletNetwork = yield walletConnector.getNetwork();
|
|
48
48
|
const walletChain = walletConnector.connectedChain;
|
|
49
49
|
const walletObject = {
|
|
50
|
-
address:
|
|
51
|
-
// We use `storedConnectedWalletInfo.lastWalletAddress` as a workaround to Braavos issue
|
|
52
|
-
// Braavos during initialization returns an empty string as a wallet address
|
|
53
|
-
walletAddress ||
|
|
54
|
-
storedConnectedWalletInfo.lastWalletAddress ||
|
|
55
|
-
'',
|
|
50
|
+
address: walletAddress || '',
|
|
56
51
|
chain: walletChain || '',
|
|
57
52
|
connected: true,
|
|
58
53
|
connector: walletConnector,
|
|
@@ -89,11 +84,10 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
89
84
|
}, [connectedWallets]);
|
|
90
85
|
const connectedWallet = connectedWallets[0] || null;
|
|
91
86
|
// Keeps connected wallet data inside localStorage
|
|
92
|
-
const applyConnectedWalletToStore = ({ walletId,
|
|
87
|
+
const applyConnectedWalletToStore = ({ walletId, walletConnectorKey, walletChain, provider, }) => {
|
|
93
88
|
const nextConnectedWalletsInfo = [...connectedWalletsInfo];
|
|
94
89
|
nextConnectedWalletsInfo.push({
|
|
95
90
|
id: walletId,
|
|
96
|
-
lastWalletAddress: walletAddress,
|
|
97
91
|
provider,
|
|
98
92
|
walletChain,
|
|
99
93
|
walletConnectorKey,
|
|
@@ -183,14 +177,16 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
183
177
|
}
|
|
184
178
|
return Promise.resolve(publicWalletAddress);
|
|
185
179
|
});
|
|
186
|
-
const unlinkConnectedWallet = (walletId) => {
|
|
180
|
+
const unlinkConnectedWallet = (walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
181
|
+
const connectedWalletToUnlink = connectedWallets.find((wallet) => wallet.id === walletId);
|
|
182
|
+
yield (connectedWalletToUnlink === null || connectedWalletToUnlink === void 0 ? void 0 : connectedWalletToUnlink.connector.endSession());
|
|
187
183
|
const filteredWallets = connectedWalletsInfo.filter((wallet) => wallet.id !== walletId);
|
|
188
184
|
if (walletId === primaryWalletId) {
|
|
189
185
|
clearPrimaryWalletId();
|
|
190
186
|
}
|
|
191
187
|
setConnectedWalletsInfo(filteredWallets);
|
|
192
188
|
onUnlink === null || onUnlink === void 0 ? void 0 : onUnlink(walletId, filteredWallets);
|
|
193
|
-
};
|
|
189
|
+
});
|
|
194
190
|
const getConnectedWalletById = React.useCallback((walletId) => connectedWallets.find((wallet) => wallet.id === walletId), [connectedWallets]);
|
|
195
191
|
return {
|
|
196
192
|
connectWallet,
|
|
@@ -6,7 +6,6 @@ export type ConnectedWalletConnectorType = {
|
|
|
6
6
|
walletChain?: Chain;
|
|
7
7
|
walletConnectorKey: string;
|
|
8
8
|
provider: string;
|
|
9
|
-
lastWalletAddress?: string;
|
|
10
9
|
};
|
|
11
10
|
type Props = {
|
|
12
11
|
authMode: AuthModeType;
|
|
@@ -28,6 +27,6 @@ export declare const useConnectWallet: ({ authMode, clearPrimaryWalletId, enable
|
|
|
28
27
|
getConnectedWalletById: (walletId: string) => Wallet | undefined;
|
|
29
28
|
refreshConnectedWallet: (walletId: string, walletConnector: WalletConnector) => Promise<void>;
|
|
30
29
|
removeConnectedWalletsInfo: () => void;
|
|
31
|
-
unlinkConnectedWallet: (walletId: string) => void
|
|
30
|
+
unlinkConnectedWallet: (walletId: string) => Promise<void>;
|
|
32
31
|
};
|
|
33
32
|
export {};
|
|
@@ -43,12 +43,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
43
43
|
const walletNetwork = yield walletConnector.getNetwork();
|
|
44
44
|
const walletChain = walletConnector.connectedChain;
|
|
45
45
|
const walletObject = {
|
|
46
|
-
address:
|
|
47
|
-
// We use `storedConnectedWalletInfo.lastWalletAddress` as a workaround to Braavos issue
|
|
48
|
-
// Braavos during initialization returns an empty string as a wallet address
|
|
49
|
-
walletAddress ||
|
|
50
|
-
storedConnectedWalletInfo.lastWalletAddress ||
|
|
51
|
-
'',
|
|
46
|
+
address: walletAddress || '',
|
|
52
47
|
chain: walletChain || '',
|
|
53
48
|
connected: true,
|
|
54
49
|
connector: walletConnector,
|
|
@@ -85,11 +80,10 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
85
80
|
}, [connectedWallets]);
|
|
86
81
|
const connectedWallet = connectedWallets[0] || null;
|
|
87
82
|
// Keeps connected wallet data inside localStorage
|
|
88
|
-
const applyConnectedWalletToStore = ({ walletId,
|
|
83
|
+
const applyConnectedWalletToStore = ({ walletId, walletConnectorKey, walletChain, provider, }) => {
|
|
89
84
|
const nextConnectedWalletsInfo = [...connectedWalletsInfo];
|
|
90
85
|
nextConnectedWalletsInfo.push({
|
|
91
86
|
id: walletId,
|
|
92
|
-
lastWalletAddress: walletAddress,
|
|
93
87
|
provider,
|
|
94
88
|
walletChain,
|
|
95
89
|
walletConnectorKey,
|
|
@@ -179,14 +173,16 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
179
173
|
}
|
|
180
174
|
return Promise.resolve(publicWalletAddress);
|
|
181
175
|
});
|
|
182
|
-
const unlinkConnectedWallet = (walletId) => {
|
|
176
|
+
const unlinkConnectedWallet = (walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
+
const connectedWalletToUnlink = connectedWallets.find((wallet) => wallet.id === walletId);
|
|
178
|
+
yield (connectedWalletToUnlink === null || connectedWalletToUnlink === void 0 ? void 0 : connectedWalletToUnlink.connector.endSession());
|
|
183
179
|
const filteredWallets = connectedWalletsInfo.filter((wallet) => wallet.id !== walletId);
|
|
184
180
|
if (walletId === primaryWalletId) {
|
|
185
181
|
clearPrimaryWalletId();
|
|
186
182
|
}
|
|
187
183
|
setConnectedWalletsInfo(filteredWallets);
|
|
188
184
|
onUnlink === null || onUnlink === void 0 ? void 0 : onUnlink(walletId, filteredWallets);
|
|
189
|
-
};
|
|
185
|
+
});
|
|
190
186
|
const getConnectedWalletById = useCallback((walletId) => connectedWallets.find((wallet) => wallet.id === walletId), [connectedWallets]);
|
|
191
187
|
return {
|
|
192
188
|
connectWallet,
|
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var data = require('../../../views/WalletList/data.cjs');
|
|
7
7
|
var verifyMagicIsSetup = require('./utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
8
8
|
|
|
9
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
9
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
10
10
|
const wallets = React.useMemo(() => {
|
|
11
11
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
12
12
|
return [];
|
|
@@ -14,6 +14,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
14
14
|
appLogoUrl,
|
|
15
15
|
appName,
|
|
16
16
|
customerApiProviders: projectSettings.providers || [],
|
|
17
|
+
deepLinkPreference,
|
|
17
18
|
flowNetwork,
|
|
18
19
|
networkConfigurations,
|
|
19
20
|
skipMemo: true,
|
|
@@ -26,6 +27,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
26
27
|
appLogoUrl,
|
|
27
28
|
appName,
|
|
28
29
|
customerApiProviders: projectSettings.providers || [],
|
|
30
|
+
deepLinkPreference,
|
|
29
31
|
flowNetwork,
|
|
30
32
|
networkConfigurations,
|
|
31
33
|
skipMemo: true,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
|
|
3
|
-
import { WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { DeepLinkVariant, WalletConnector, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
5
5
|
type Props = {
|
|
6
6
|
appLogoUrl?: string;
|
|
7
7
|
appName?: string;
|
|
8
|
+
deepLinkPreference?: DeepLinkVariant;
|
|
8
9
|
flowNetwork?: 'mainnet' | 'testnet';
|
|
9
10
|
networkConfigurations: NetworkConfigurationMap | undefined;
|
|
10
11
|
projectSettings: ProjectSettings | undefined;
|
|
@@ -13,7 +14,7 @@ type Props = {
|
|
|
13
14
|
walletConnectorsProp?: WalletConnectorsMethod[];
|
|
14
15
|
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
15
16
|
};
|
|
16
|
-
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
17
|
+
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
17
18
|
wallets: import("../../../shared").WalletOption[];
|
|
18
19
|
};
|
|
19
20
|
export {};
|
|
@@ -2,7 +2,7 @@ import { useMemo, useEffect } from 'react';
|
|
|
2
2
|
import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
|
|
3
3
|
import { verifyMagicIsSetup } from './utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
4
4
|
|
|
5
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
5
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, deepLinkPreference, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
6
6
|
const wallets = useMemo(() => {
|
|
7
7
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
8
8
|
return [];
|
|
@@ -10,6 +10,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
10
10
|
appLogoUrl,
|
|
11
11
|
appName,
|
|
12
12
|
customerApiProviders: projectSettings.providers || [],
|
|
13
|
+
deepLinkPreference,
|
|
13
14
|
flowNetwork,
|
|
14
15
|
networkConfigurations,
|
|
15
16
|
skipMemo: true,
|
|
@@ -22,6 +23,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
22
23
|
appLogoUrl,
|
|
23
24
|
appName,
|
|
24
25
|
customerApiProviders: projectSettings.providers || [],
|
|
26
|
+
deepLinkPreference,
|
|
25
27
|
flowNetwork,
|
|
26
28
|
networkConfigurations,
|
|
27
29
|
skipMemo: true,
|
|
@@ -48,7 +48,7 @@ var index = require('../UserDataFields/index.cjs');
|
|
|
48
48
|
var useUserDataForm = require('../../../utils/hooks/useUserDataForm/useUserDataForm.cjs');
|
|
49
49
|
|
|
50
50
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
51
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt,
|
|
51
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, internalSetShowAuthFlow, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
52
52
|
const { setView, view } = ViewContext.useViewContext();
|
|
53
53
|
const decodedJwt = decodeJwt.decodeJwt(onboardingOnlyJwt);
|
|
54
54
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
@@ -67,9 +67,9 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
67
67
|
setView(view);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
internalSetShowAuthFlow(false);
|
|
71
71
|
setCallback('authSuccess');
|
|
72
|
-
}), [setCallback,
|
|
72
|
+
}), [setCallback, internalSetShowAuthFlow, setView, updateUser]);
|
|
73
73
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm.useUserDataForm({
|
|
74
74
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
75
75
|
onSubmit,
|
|
@@ -44,7 +44,7 @@ import { UserDataFields } from '../UserDataFields/index.js';
|
|
|
44
44
|
import { useUserDataForm } from '../../../utils/hooks/useUserDataForm/useUserDataForm.js';
|
|
45
45
|
|
|
46
46
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
47
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt,
|
|
47
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, internalSetShowAuthFlow, setCallback, } = useInternalDynamicContext();
|
|
48
48
|
const { setView, view } = useViewContext();
|
|
49
49
|
const decodedJwt = decodeJwt(onboardingOnlyJwt);
|
|
50
50
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
@@ -63,9 +63,9 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
63
63
|
setView(view);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
internalSetShowAuthFlow(false);
|
|
67
67
|
setCallback('authSuccess');
|
|
68
|
-
}), [setCallback,
|
|
68
|
+
}), [setCallback, internalSetShowAuthFlow, setView, updateUser]);
|
|
69
69
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm({
|
|
70
70
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
71
71
|
onSubmit,
|
|
@@ -46,6 +46,7 @@ const viewToComponentMap = {
|
|
|
46
46
|
'login-with-email-or-wallet-full-wallet-list': jsxRuntime.jsx(WalletList.WalletList, {}),
|
|
47
47
|
'login-with-email-verification': jsxRuntime.jsx(EmailVerification.EmailVerification, {}),
|
|
48
48
|
'merge-user-accounts': jsxRuntime.jsx(MergeUserAccountsView.MergeUserAccountsView, {}),
|
|
49
|
+
'multi-wallet-wallet-list': jsxRuntime.jsx(WalletList.WalletList, {}),
|
|
49
50
|
'network-not-supported': jsxRuntime.jsx(NetworkNotSupported.NetworkNotSupported, {}),
|
|
50
51
|
'network-not-supported-manual': jsxRuntime.jsx(NetworkNotSupportedSwitchManual.NetworkNotSupportedSwitchManual, {}),
|
|
51
52
|
'no-access': jsxRuntime.jsx(NoAccess.NoAccess, {}),
|
|
@@ -42,6 +42,7 @@ const viewToComponentMap = {
|
|
|
42
42
|
'login-with-email-or-wallet-full-wallet-list': jsx(WalletList, {}),
|
|
43
43
|
'login-with-email-verification': jsx(EmailVerification, {}),
|
|
44
44
|
'merge-user-accounts': jsx(MergeUserAccountsView, {}),
|
|
45
|
+
'multi-wallet-wallet-list': jsx(WalletList, {}),
|
|
45
46
|
'network-not-supported': jsx(NetworkNotSupported, {}),
|
|
46
47
|
'network-not-supported-manual': jsx(NetworkNotSupportedSwitchManual, {}),
|
|
47
48
|
'no-access': jsx(NoAccess, {}),
|
|
@@ -14,7 +14,7 @@ var UserProfileForm = require('../../../../components/UserProfileForm/UserProfil
|
|
|
14
14
|
const EditProfileView = () => {
|
|
15
15
|
const { setView } = ViewContext.useViewContext();
|
|
16
16
|
const { goToProfileView } = DynamicBridgeWidgetContext.useDynamicBridgeWidgetContext();
|
|
17
|
-
const {
|
|
17
|
+
const { internalSetShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
18
18
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
19
19
|
validationSchemaStripUnknown: true,
|
|
20
20
|
});
|
|
@@ -22,10 +22,10 @@ const EditProfileView = () => {
|
|
|
22
22
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
23
23
|
goToProfileView();
|
|
24
24
|
if (isEmailVerificationRequired) {
|
|
25
|
-
|
|
25
|
+
internalSetShowAuthFlow(true);
|
|
26
26
|
setView('verify-email');
|
|
27
27
|
}
|
|
28
|
-
}), [goToProfileView,
|
|
28
|
+
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
29
29
|
return (jsxRuntime.jsx(UserProfileForm.UserProfileForm, { onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView }));
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -10,7 +10,7 @@ import { UserProfileForm } from '../../../../components/UserProfileForm/UserProf
|
|
|
10
10
|
const EditProfileView = () => {
|
|
11
11
|
const { setView } = useViewContext();
|
|
12
12
|
const { goToProfileView } = useDynamicBridgeWidgetContext();
|
|
13
|
-
const {
|
|
13
|
+
const { internalSetShowAuthFlow } = useInternalDynamicContext();
|
|
14
14
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
15
15
|
validationSchemaStripUnknown: true,
|
|
16
16
|
});
|
|
@@ -18,10 +18,10 @@ const EditProfileView = () => {
|
|
|
18
18
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
19
19
|
goToProfileView();
|
|
20
20
|
if (isEmailVerificationRequired) {
|
|
21
|
-
|
|
21
|
+
internalSetShowAuthFlow(true);
|
|
22
22
|
setView('verify-email');
|
|
23
23
|
}
|
|
24
|
-
}), [goToProfileView,
|
|
24
|
+
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
25
25
|
return (jsx(UserProfileForm, { onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView }));
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -50,7 +50,7 @@ var UserProfileForm = require('../../../../components/UserProfileForm/UserProfil
|
|
|
50
50
|
|
|
51
51
|
const EditProfileView = ({ rootClassName, }) => {
|
|
52
52
|
const { setView } = ViewContext.useViewContext();
|
|
53
|
-
const {
|
|
53
|
+
const { internalSetShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
54
54
|
const { goToProfileView } = DynamicWidgetContext.useWidgetContext();
|
|
55
55
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
56
56
|
validationSchemaStripUnknown: true,
|
|
@@ -59,10 +59,10 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
59
59
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
60
60
|
goToProfileView();
|
|
61
61
|
if (isEmailVerificationRequired) {
|
|
62
|
-
|
|
62
|
+
internalSetShowAuthFlow(true);
|
|
63
63
|
setView('verify-email');
|
|
64
64
|
}
|
|
65
|
-
}), [goToProfileView,
|
|
65
|
+
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
66
66
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
67
67
|
const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
|
|
68
68
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My profile" })), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
@@ -46,7 +46,7 @@ import { UserProfileForm } from '../../../../components/UserProfileForm/UserProf
|
|
|
46
46
|
|
|
47
47
|
const EditProfileView = ({ rootClassName, }) => {
|
|
48
48
|
const { setView } = useViewContext();
|
|
49
|
-
const {
|
|
49
|
+
const { internalSetShowAuthFlow } = useInternalDynamicContext();
|
|
50
50
|
const { goToProfileView } = useWidgetContext();
|
|
51
51
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
52
52
|
validationSchemaStripUnknown: true,
|
|
@@ -55,10 +55,10 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
55
55
|
const { isEmailVerificationRequired } = yield updateUser(formValues);
|
|
56
56
|
goToProfileView();
|
|
57
57
|
if (isEmailVerificationRequired) {
|
|
58
|
-
|
|
58
|
+
internalSetShowAuthFlow(true);
|
|
59
59
|
setView('verify-email');
|
|
60
60
|
}
|
|
61
|
-
}), [goToProfileView,
|
|
61
|
+
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
62
62
|
const isKYCEnabled = useKYCFlag();
|
|
63
63
|
const isMultiWalletEnabled = useMultiWalletFlag();
|
|
64
64
|
return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My profile" })), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|