@dynamic-labs/sdk-react-core 2.1.0-alpha.15 → 2.1.0-alpha.17
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 +16 -0
- package/package.cjs +3 -2
- package/package.js +3 -2
- package/package.json +13 -12
- package/src/index.cjs +0 -2
- package/src/index.d.ts +1 -3
- package/src/index.js +0 -1
- package/src/lib/components/Portal/Portal.cjs +3 -1
- package/src/lib/components/Portal/Portal.js +3 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -14
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -14
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +5 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +5 -1
- package/src/lib/context/DynamicContext/types/index.d.ts +4 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/DynamicContext/validators/validators.cjs +0 -29
- package/src/lib/context/DynamicContext/validators/validators.d.ts +0 -2
- package/src/lib/context/DynamicContext/validators/validators.js +1 -29
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/locale/en/translation.cjs +18 -0
- package/src/lib/locale/en/translation.d.ts +18 -0
- package/src/lib/locale/en/translation.js +18 -0
- package/src/lib/shared/utils/classes/storage/localStorage.cjs +1 -8
- package/src/lib/shared/utils/classes/storage/localStorage.js +2 -9
- package/src/lib/shared/utils/functions/index.d.ts +0 -1
- package/src/lib/shared/utils/functions/wallet/createWallet.d.ts +0 -4
- package/src/lib/store/actions/storeActions/index.d.ts +1 -0
- package/src/lib/store/actions/storeActions/storeActions.cjs +10 -0
- package/src/lib/store/actions/storeActions/storeActions.d.ts +1 -0
- package/src/lib/store/actions/storeActions/storeActions.js +6 -0
- package/src/lib/store/actions/userActions/index.d.ts +1 -0
- package/src/lib/store/actions/userActions/userActions.cjs +10 -0
- package/src/lib/store/actions/userActions/userActions.d.ts +7 -0
- package/src/lib/store/actions/userActions/userActions.js +6 -0
- package/src/lib/store/hooks/useUser/index.d.ts +1 -0
- package/src/lib/store/hooks/useUser/useUser.cjs +12 -0
- package/src/lib/store/hooks/useUser/useUser.d.ts +1 -0
- package/src/lib/store/hooks/useUser/useUser.js +8 -0
- package/src/lib/store/index.d.ts +4 -0
- package/src/lib/store/store.cjs +24 -0
- package/src/lib/store/store.d.ts +13 -0
- package/src/lib/store/store.js +19 -0
- package/src/lib/store/types.d.ts +4 -0
- package/src/lib/store/utils/createStore/createStore.cjs +21 -0
- package/src/lib/store/utils/createStore/createStore.d.ts +16 -0
- package/src/lib/store/utils/createStore/createStore.js +17 -0
- package/src/lib/store/utils/createStore/index.d.ts +1 -0
- package/src/lib/store/utils/syncLegacyStorage/index.d.ts +1 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.cjs +30 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.d.ts +2 -0
- package/src/lib/store/utils/syncLegacyStorage/syncLegacyStorage.js +26 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +2 -2
- package/src/lib/utils/constants/localStorage.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.js +2 -2
- package/src/lib/utils/functions/downloadFile/downloadFile.cjs +15 -0
- package/src/lib/utils/functions/downloadFile/downloadFile.d.ts +1 -0
- package/src/lib/utils/functions/downloadFile/downloadFile.js +11 -0
- package/src/lib/utils/functions/downloadFile/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +4 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +4 -2
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +6 -3
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.d.ts +1 -4
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +5 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +6 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +1 -4
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +5 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.cjs +2 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.js +2 -1
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +5 -10
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +5 -10
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +111 -0
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.d.ts +2 -0
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +107 -0
- package/src/lib/views/MfaDisplayBackupCodesView/index.d.ts +1 -0
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +3 -3
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +3 -3
- package/src/lib/views/WalletList/WalletListGridTabs/WalletListGridTabs.cjs +1 -1
- package/src/lib/views/WalletList/WalletListGridTabs/WalletListGridTabs.js +1 -1
- package/src/lib/views/WalletList/hooks/useTabState.cjs +4 -1
- package/src/lib/views/WalletList/hooks/useTabState.js +4 -1
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.cjs +22 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.d.ts +2 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/getInitialTabIndex.js +18 -0
- package/src/lib/views/WalletList/utils/getInitialTabIndex/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/shared/utils/functions/validateType/index.d.ts +0 -1
- package/src/lib/shared/utils/functions/validateType/validateType.cjs +0 -30
- package/src/lib/shared/utils/functions/validateType/validateType.d.ts +0 -1
- package/src/lib/shared/utils/functions/validateType/validateType.js +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.16...v2.1.0-alpha.17) (2024-05-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add coinbaseWalletPreference prop ([#5607](https://github.com/dynamic-labs/DynamicAuth/issues/5607)) ([1ac3b2c](https://github.com/dynamic-labs/DynamicAuth/commit/1ac3b2ce7abb136465f4aa88b045dfb70d99aad7))
|
|
8
|
+
|
|
9
|
+
## [2.1.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.15...v2.1.0-alpha.16) (2024-05-14)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add client.sdk.error with errors from the webview ([#5520](https://github.com/dynamic-labs/DynamicAuth/issues/5520)) ([a886927](https://github.com/dynamic-labs/DynamicAuth/commit/a8869273bf361c870d6e3cb82a28d9ccec65905b))
|
|
15
|
+
* add setDefaultTabIndex to default the selected wallets tab ([#5593](https://github.com/dynamic-labs/DynamicAuth/issues/5593)) ([6e8ce05](https://github.com/dynamic-labs/DynamicAuth/commit/6e8ce053c4f6f009acc57dac55a8e9c74fbcc73b))
|
|
16
|
+
* add visibility/auth-flow/user-profile to react-native ([#5564](https://github.com/dynamic-labs/DynamicAuth/issues/5564)) ([d93cea8](https://github.com/dynamic-labs/DynamicAuth/commit/d93cea82a123c6ec4d3d594a7dc064f4db2981c2))
|
|
17
|
+
|
|
2
18
|
## [2.1.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.14...v2.1.0-alpha.15) (2024-05-13)
|
|
3
19
|
|
|
4
20
|
|
package/package.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.1.0-alpha.
|
|
6
|
+
var version = "2.1.0-alpha.17";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.433",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -14,7 +14,8 @@ var dependencies = {
|
|
|
14
14
|
"react-focus-lock": "2.9.2",
|
|
15
15
|
"react-i18next": "13.5.0",
|
|
16
16
|
yup: "0.32.11",
|
|
17
|
-
"react-international-phone": "4.2.5"
|
|
17
|
+
"react-international-phone": "4.2.5",
|
|
18
|
+
zustand: "4.5.2"
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
exports.dependencies = dependencies;
|
package/package.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "2.1.0-alpha.
|
|
2
|
+
var version = "2.1.0-alpha.17";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.433",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -10,7 +10,8 @@ var dependencies = {
|
|
|
10
10
|
"react-focus-lock": "2.9.2",
|
|
11
11
|
"react-i18next": "13.5.0",
|
|
12
12
|
yup: "0.32.11",
|
|
13
|
-
"react-international-phone": "4.2.5"
|
|
13
|
+
"react-international-phone": "4.2.5",
|
|
14
|
+
zustand: "4.5.2"
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export { dependencies, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.17",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,17 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"
|
|
21
|
-
"@dynamic-labs/
|
|
22
|
-
"@dynamic-labs/
|
|
23
|
-
"@dynamic-labs/
|
|
24
|
-
"@dynamic-labs/rpc-provider-
|
|
25
|
-
"@dynamic-labs/rpc-
|
|
26
|
-
"@dynamic-labs/
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/
|
|
29
|
-
"@dynamic-labs/
|
|
30
|
-
"@dynamic-labs/wallet-
|
|
20
|
+
"zustand": "4.5.2",
|
|
21
|
+
"@dynamic-labs/iconic": "2.1.0-alpha.17",
|
|
22
|
+
"@dynamic-labs/logger": "2.1.0-alpha.17",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "2.1.0-alpha.17",
|
|
24
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.17",
|
|
25
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.17",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.17",
|
|
27
|
+
"@dynamic-labs/types": "2.1.0-alpha.17",
|
|
28
|
+
"@dynamic-labs/utils": "2.1.0-alpha.17",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.17",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.17",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.17",
|
|
31
32
|
"eventemitter3": "5.0.1"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -22,7 +22,6 @@ var useWalletConnectorEvent = require('./lib/utils/hooks/events/useWalletConnect
|
|
|
22
22
|
var useAuthenticateConnectedUser = require('./lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs');
|
|
23
23
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
24
24
|
require('./lib/shared/logger.cjs');
|
|
25
|
-
var validateType = require('./lib/shared/utils/functions/validateType/validateType.cjs');
|
|
26
25
|
var getChainIcon = require('./lib/shared/utils/functions/chain/getChainIcon.cjs');
|
|
27
26
|
var getChainDisplayName = require('./lib/shared/utils/functions/chain/getChainDisplayName.cjs');
|
|
28
27
|
var createWallet = require('./lib/shared/utils/functions/wallet/createWallet.cjs');
|
|
@@ -167,7 +166,6 @@ Object.defineProperty(exports, 'DynamicJwtFromJSON', {
|
|
|
167
166
|
enumerable: true,
|
|
168
167
|
get: function () { return sdkApiCore.DynamicJwtFromJSON; }
|
|
169
168
|
});
|
|
170
|
-
exports.validateType = validateType.validateType;
|
|
171
169
|
exports.getChainIcon = getChainIcon.getChainIcon;
|
|
172
170
|
exports.getChainDisplayName = getChainDisplayName.getChainDisplayName;
|
|
173
171
|
exports.createWallet = createWallet.createWallet;
|
package/src/index.d.ts
CHANGED
|
@@ -61,9 +61,7 @@ SpinnerIcon, type AccessDeniedCustomButton, type AccountSwitchState, type AuthMo
|
|
|
61
61
|
/** @deprecated */
|
|
62
62
|
useLocalStorage,
|
|
63
63
|
/** @deprecated */
|
|
64
|
-
useOnClickOutside,
|
|
65
|
-
/** @deprecated */
|
|
66
|
-
validateType, } from './lib/shared';
|
|
64
|
+
useOnClickOutside, } from './lib/shared';
|
|
67
65
|
export {
|
|
68
66
|
/** @deprecated */
|
|
69
67
|
CollectUserDataView,
|
package/src/index.js
CHANGED
|
@@ -18,7 +18,6 @@ export { useWalletConnectorEvent } from './lib/utils/hooks/events/useWalletConne
|
|
|
18
18
|
export { useAuthenticateConnectedUser } from './lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js';
|
|
19
19
|
export { DynamicJwtFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
20
20
|
import './lib/shared/logger.js';
|
|
21
|
-
export { validateType } from './lib/shared/utils/functions/validateType/validateType.js';
|
|
22
21
|
export { getChainIcon } from './lib/shared/utils/functions/chain/getChainIcon.js';
|
|
23
22
|
export { getChainDisplayName } from './lib/shared/utils/functions/chain/getChainDisplayName.js';
|
|
24
23
|
export { createWallet } from './lib/shared/utils/functions/wallet/createWallet.js';
|
|
@@ -87,7 +87,9 @@ const ModalComponent = ({ children, handleClose, withBackdrop = true, zIndex, wh
|
|
|
87
87
|
view.type !== 'login-with-email-verification' &&
|
|
88
88
|
view.type !== 'login-with-sms-verification' &&
|
|
89
89
|
view.type !== 'verify-sms' &&
|
|
90
|
-
view.type !== 'verify-email'
|
|
90
|
+
view.type !== 'verify-email' &&
|
|
91
|
+
view.type !== 'mfa-verification' &&
|
|
92
|
+
view.type !== 'mfa-display-backup-codes';
|
|
91
93
|
const onBackdropClick = (e) => {
|
|
92
94
|
if (!shouldCloseOnBackdropClick)
|
|
93
95
|
return;
|
|
@@ -79,7 +79,9 @@ const ModalComponent = ({ children, handleClose, withBackdrop = true, zIndex, wh
|
|
|
79
79
|
view.type !== 'login-with-email-verification' &&
|
|
80
80
|
view.type !== 'login-with-sms-verification' &&
|
|
81
81
|
view.type !== 'verify-sms' &&
|
|
82
|
-
view.type !== 'verify-email'
|
|
82
|
+
view.type !== 'verify-email' &&
|
|
83
|
+
view.type !== 'mfa-verification' &&
|
|
84
|
+
view.type !== 'mfa-display-backup-codes';
|
|
83
85
|
const onBackdropClick = (e) => {
|
|
84
86
|
if (!shouldCloseOnBackdropClick)
|
|
85
87
|
return;
|
|
@@ -115,6 +115,9 @@ var FundingContext = require('../FundingContext/FundingContext.cjs');
|
|
|
115
115
|
var PhantomRedirectContext = require('../PhantomRedirectContext/PhantomRedirectContext.cjs');
|
|
116
116
|
var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs');
|
|
117
117
|
var UseNetworkValidation = require('../UseNetworkValidation/UseNetworkValidation.cjs');
|
|
118
|
+
var userActions = require('../../store/actions/userActions/userActions.cjs');
|
|
119
|
+
var store = require('../../store/store.cjs');
|
|
120
|
+
var useUser = require('../../store/hooks/useUser/useUser.cjs');
|
|
118
121
|
var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
|
|
119
122
|
var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
|
|
120
123
|
var useHandleLogout = require('./hooks/useHandleLogout/useHandleLogout.cjs');
|
|
@@ -126,15 +129,20 @@ var useTieCallbacksToEvents = require('./hooks/useTieCallbacksToEvents/useTieCal
|
|
|
126
129
|
var useMultiWallet = require('./hooks/useMultiWallet/useMultiWallet.cjs');
|
|
127
130
|
var useParentDynamicContextGuard = require('./hooks/useParentDynamicContextGuard/useParentDynamicContextGuard.cjs');
|
|
128
131
|
var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
|
|
129
|
-
var validators = require('./validators/validators.cjs');
|
|
130
132
|
|
|
131
133
|
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
132
|
-
const EMPTY_INITIAL_USER = undefined;
|
|
133
134
|
const DynamicContext = React.createContext(undefined);
|
|
134
135
|
/** The context provider itself we only use internally */
|
|
135
136
|
const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, locale: locale$1, }) => {
|
|
136
137
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
137
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId,
|
|
138
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings$1;
|
|
139
|
+
localStorage.LocalStorage.setSuffix(settings$1.localStorageSuffix);
|
|
140
|
+
/**
|
|
141
|
+
* initialize global store
|
|
142
|
+
*/
|
|
143
|
+
store.initializeStore({
|
|
144
|
+
storageSuffix: settings$1.localStorageSuffix,
|
|
145
|
+
});
|
|
138
146
|
/**
|
|
139
147
|
* For backwards compatibility, we allow the client to pass in
|
|
140
148
|
* `eventsCallbacks` instead of `events`. It should remove this
|
|
@@ -156,12 +164,12 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
156
164
|
logger$1.logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
157
165
|
}
|
|
158
166
|
ApiEndpoint.setBaseUrl((_b = process.env.DYNAMIC_API_BASE_URL) !== null && _b !== void 0 ? _b : apiBaseUrl);
|
|
159
|
-
localStorage.LocalStorage.setSuffix(localStorageSuffix);
|
|
160
167
|
const i18nSDKInstance = locale.Locale.setup(locale$1);
|
|
161
168
|
const isAuthenticated = Boolean(getAuthToken.getAuthToken());
|
|
162
169
|
const isBridgeFlow = Boolean(bridgeChains);
|
|
163
170
|
const deepLinkPreference = helpers.getDeepLinkPreference(deepLinkPreferenceProp, isBridgeFlow);
|
|
164
171
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = React.useState(undefined);
|
|
172
|
+
const [defaultTabIndex, setDefaultTabIndex] = React.useState(0);
|
|
165
173
|
// state to track the full connectivity status of the individual's wallets.
|
|
166
174
|
// Set to true once the predetermined number of wallets is connected.
|
|
167
175
|
const [bridgeOnboardingCompleted, setBridgeOnboardingCompleted, removeBridgeOnboardingCompleted,] = useLocalStorage.useLocalStorage(localStorage$1.BRIDGE_ONBOARDING_COMPLETED, false);
|
|
@@ -170,7 +178,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
170
178
|
// Alows clients to control the Bridget Widget flow without need to click on Bridge Widget
|
|
171
179
|
const [showBridgeWidget, setShowBridgeWidget] = React.useState(false);
|
|
172
180
|
const [isSingleWalletAccount, setIsSingleWalletAccount] = React.useState(false);
|
|
173
|
-
const
|
|
181
|
+
const user = useUser.useUser();
|
|
174
182
|
if (user) {
|
|
175
183
|
logger$1.logger.setMetaData('user', user);
|
|
176
184
|
}
|
|
@@ -216,6 +224,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
216
224
|
const { walletConnectorOptions } = useWalletConnectorOptions.useWalletConnectorOptions({
|
|
217
225
|
appLogoUrl,
|
|
218
226
|
appName,
|
|
227
|
+
coinbaseWalletPreference,
|
|
219
228
|
deepLinkPreference,
|
|
220
229
|
flowNetwork,
|
|
221
230
|
mobileExperience,
|
|
@@ -231,7 +240,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
231
240
|
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId.usePrimaryWalletId({
|
|
232
241
|
environmentId,
|
|
233
242
|
minAuthToken: getMinAuthToken.getMinAuthToken(),
|
|
234
|
-
setUser,
|
|
235
243
|
});
|
|
236
244
|
// this is a state because it's set based on primaryWallet and bridgeChainsToConnect,
|
|
237
245
|
// which are only available further down and have would have circular dependencies
|
|
@@ -314,7 +322,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
314
322
|
removeConnectedNameService,
|
|
315
323
|
removeConnectedWalletsInfo,
|
|
316
324
|
removeLsSettings,
|
|
317
|
-
removeUser,
|
|
318
325
|
resetLoginWithEmail,
|
|
319
326
|
setAuthMode,
|
|
320
327
|
setLegacyIsVerifying,
|
|
@@ -342,7 +349,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
342
349
|
environmentId,
|
|
343
350
|
primaryWalletId,
|
|
344
351
|
secondaryWallets,
|
|
345
|
-
setUser,
|
|
346
352
|
verifiedCredentials: (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [],
|
|
347
353
|
});
|
|
348
354
|
const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork.useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
@@ -399,9 +405,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
399
405
|
if (authMode !== 'connect-only') {
|
|
400
406
|
removeConnectedWalletsInfo();
|
|
401
407
|
}
|
|
402
|
-
if (!localStorage.LocalStorage.getFromLS(localStorage$1.AUTH_USER)) {
|
|
403
|
-
localStorage.LocalStorage.removeFromLS(localStorage$1.AUTH_TOKEN);
|
|
404
|
-
}
|
|
405
408
|
if (localStorage.LocalStorage.getFromLS(localStorage$1.WALLET_PICKER_SEARCH_KEY)) {
|
|
406
409
|
localStorage.LocalStorage.removeFromLS(localStorage$1.WALLET_PICKER_SEARCH_KEY);
|
|
407
410
|
}
|
|
@@ -447,6 +450,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
447
450
|
debugError,
|
|
448
451
|
decodedOnboardingOnlyToken: decodeJwt.decodeJwt(onboardingOnlyJwt),
|
|
449
452
|
defaultNumberOfWalletsToShow,
|
|
453
|
+
defaultTabIndex,
|
|
450
454
|
desktopUri,
|
|
451
455
|
disconnectWallet,
|
|
452
456
|
displaySiweStatement,
|
|
@@ -503,6 +507,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
503
507
|
setAuthorizationViewDisplayOrder,
|
|
504
508
|
setBridgeOnboardingCompleted,
|
|
505
509
|
setCallback,
|
|
510
|
+
setDefaultTabIndex,
|
|
506
511
|
setDesktopUri,
|
|
507
512
|
setIsSingleWalletAccount,
|
|
508
513
|
setLegacyIsVerifying,
|
|
@@ -520,7 +525,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
520
525
|
setShowDynamicUserProfile,
|
|
521
526
|
setShowQrcodeModal,
|
|
522
527
|
setShowWidgetStatePopup,
|
|
523
|
-
setUser,
|
|
528
|
+
setUser: userActions.setUser,
|
|
524
529
|
shadowDOMEnabled,
|
|
525
530
|
showAuthFlow,
|
|
526
531
|
showBridgeWidget,
|
|
@@ -551,6 +556,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
551
556
|
handlers,
|
|
552
557
|
appLogoUrl,
|
|
553
558
|
appName,
|
|
559
|
+
defaultTabIndex,
|
|
554
560
|
authMode,
|
|
555
561
|
authorizationViewDisplayOrder,
|
|
556
562
|
awaitingSignatureState,
|
|
@@ -627,7 +633,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
627
633
|
setSelectedWalletConnectorKey,
|
|
628
634
|
setShowAuthFlow,
|
|
629
635
|
setShowQrcodeModal,
|
|
630
|
-
setUser,
|
|
631
636
|
shadowDOMEnabled,
|
|
632
637
|
showAuthFlow,
|
|
633
638
|
showBridgeWidget,
|
|
@@ -683,7 +688,8 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
683
688
|
if (user && multiWalletWidgetState !== 'idle' && !showDynamicUserProfile) {
|
|
684
689
|
setShowDynamicUserProfile(true);
|
|
685
690
|
}
|
|
686
|
-
|
|
691
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
692
|
+
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
687
693
|
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsx(DynamicContext.Provider, { value: value, children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { customerTheme: parseTheme.parseTheme(theme, ((_g = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _g === void 0 ? void 0 : _g.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialView: helpers.getInitialView({
|
|
688
694
|
bridgeOnboardingCompleted,
|
|
689
695
|
connectedWallets,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { LogLevel } from '@dynamic-labs/logger';
|
|
3
|
-
import { SocialProviderFilter } from '@dynamic-labs/types';
|
|
3
|
+
import { type CoinbaseWalletPreference, type SocialProviderFilter } from '@dynamic-labs/types';
|
|
4
4
|
import { DeepLinkVariant, WalletConnectorExtension, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { LocaleResource } from '../../locale';
|
|
6
6
|
import { AccessDeniedCustomButton, AuthModeType, ChainToWalletMap, DynamicEventsCallbacks, RecommendedWallet, WalletOption } from '../../shared';
|
|
@@ -20,6 +20,7 @@ export interface DynamicContextProps {
|
|
|
20
20
|
appLogoUrl?: string;
|
|
21
21
|
appName?: string;
|
|
22
22
|
bridgeChains?: ChainsToConnect[];
|
|
23
|
+
coinbaseWalletPreference?: CoinbaseWalletPreference;
|
|
23
24
|
cssOverrides?: string | JSX.Element;
|
|
24
25
|
customPrivacyPolicy?: ReactNode;
|
|
25
26
|
customTermsOfServices?: ReactNode;
|
|
@@ -14,7 +14,7 @@ import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
|
14
14
|
import '@dynamic-labs/sdk-api-core';
|
|
15
15
|
import { logger } from '../../shared/logger.js';
|
|
16
16
|
import { ViewContextProvider } from '../ViewContext/ViewContext.js';
|
|
17
|
-
import { BRIDGE_ONBOARDING_COMPLETED,
|
|
17
|
+
import { BRIDGE_ONBOARDING_COMPLETED, AUTH_MODE, WALLET_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
18
18
|
import '../../utils/constants/colors.js';
|
|
19
19
|
import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
|
|
20
20
|
import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -111,6 +111,9 @@ import { FundingContextProvider } from '../FundingContext/FundingContext.js';
|
|
|
111
111
|
import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/PhantomRedirectContext.js';
|
|
112
112
|
import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
|
|
113
113
|
import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
|
|
114
|
+
import { setUser } from '../../store/actions/userActions/userActions.js';
|
|
115
|
+
import { initializeStore } from '../../store/store.js';
|
|
116
|
+
import { useUser } from '../../store/hooks/useUser/useUser.js';
|
|
114
117
|
import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
|
|
115
118
|
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
116
119
|
import { useHandleLogout } from './hooks/useHandleLogout/useHandleLogout.js';
|
|
@@ -122,15 +125,20 @@ import { useTieCallbacksToEvents } from './hooks/useTieCallbacksToEvents/useTieC
|
|
|
122
125
|
import { useMultiWallet } from './hooks/useMultiWallet/useMultiWallet.js';
|
|
123
126
|
import { useParentDynamicContextGuard } from './hooks/useParentDynamicContextGuard/useParentDynamicContextGuard.js';
|
|
124
127
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
125
|
-
import { validateAuthUser } from './validators/validators.js';
|
|
126
128
|
|
|
127
129
|
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
128
|
-
const EMPTY_INITIAL_USER = undefined;
|
|
129
130
|
const DynamicContext = createContext(undefined);
|
|
130
131
|
/** The context provider itself we only use internally */
|
|
131
132
|
const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
132
133
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
133
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId,
|
|
134
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings;
|
|
135
|
+
LocalStorage.setSuffix(settings.localStorageSuffix);
|
|
136
|
+
/**
|
|
137
|
+
* initialize global store
|
|
138
|
+
*/
|
|
139
|
+
initializeStore({
|
|
140
|
+
storageSuffix: settings.localStorageSuffix,
|
|
141
|
+
});
|
|
134
142
|
/**
|
|
135
143
|
* For backwards compatibility, we allow the client to pass in
|
|
136
144
|
* `eventsCallbacks` instead of `events`. It should remove this
|
|
@@ -152,12 +160,12 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
152
160
|
logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
153
161
|
}
|
|
154
162
|
ApiEndpoint.setBaseUrl((_b = process.env.DYNAMIC_API_BASE_URL) !== null && _b !== void 0 ? _b : apiBaseUrl);
|
|
155
|
-
LocalStorage.setSuffix(localStorageSuffix);
|
|
156
163
|
const i18nSDKInstance = Locale.setup(locale);
|
|
157
164
|
const isAuthenticated = Boolean(getAuthToken());
|
|
158
165
|
const isBridgeFlow = Boolean(bridgeChains);
|
|
159
166
|
const deepLinkPreference = getDeepLinkPreference(deepLinkPreferenceProp, isBridgeFlow);
|
|
160
167
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = useState(undefined);
|
|
168
|
+
const [defaultTabIndex, setDefaultTabIndex] = useState(0);
|
|
161
169
|
// state to track the full connectivity status of the individual's wallets.
|
|
162
170
|
// Set to true once the predetermined number of wallets is connected.
|
|
163
171
|
const [bridgeOnboardingCompleted, setBridgeOnboardingCompleted, removeBridgeOnboardingCompleted,] = useLocalStorage(BRIDGE_ONBOARDING_COMPLETED, false);
|
|
@@ -166,7 +174,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
166
174
|
// Alows clients to control the Bridget Widget flow without need to click on Bridge Widget
|
|
167
175
|
const [showBridgeWidget, setShowBridgeWidget] = useState(false);
|
|
168
176
|
const [isSingleWalletAccount, setIsSingleWalletAccount] = useState(false);
|
|
169
|
-
const
|
|
177
|
+
const user = useUser();
|
|
170
178
|
if (user) {
|
|
171
179
|
logger.setMetaData('user', user);
|
|
172
180
|
}
|
|
@@ -212,6 +220,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
212
220
|
const { walletConnectorOptions } = useWalletConnectorOptions({
|
|
213
221
|
appLogoUrl,
|
|
214
222
|
appName,
|
|
223
|
+
coinbaseWalletPreference,
|
|
215
224
|
deepLinkPreference,
|
|
216
225
|
flowNetwork,
|
|
217
226
|
mobileExperience,
|
|
@@ -227,7 +236,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
227
236
|
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId({
|
|
228
237
|
environmentId,
|
|
229
238
|
minAuthToken: getMinAuthToken(),
|
|
230
|
-
setUser,
|
|
231
239
|
});
|
|
232
240
|
// this is a state because it's set based on primaryWallet and bridgeChainsToConnect,
|
|
233
241
|
// which are only available further down and have would have circular dependencies
|
|
@@ -310,7 +318,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
310
318
|
removeConnectedNameService,
|
|
311
319
|
removeConnectedWalletsInfo,
|
|
312
320
|
removeLsSettings,
|
|
313
|
-
removeUser,
|
|
314
321
|
resetLoginWithEmail,
|
|
315
322
|
setAuthMode,
|
|
316
323
|
setLegacyIsVerifying,
|
|
@@ -338,7 +345,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
338
345
|
environmentId,
|
|
339
346
|
primaryWalletId,
|
|
340
347
|
secondaryWallets,
|
|
341
|
-
setUser,
|
|
342
348
|
verifiedCredentials: (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [],
|
|
343
349
|
});
|
|
344
350
|
const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
@@ -395,9 +401,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
395
401
|
if (authMode !== 'connect-only') {
|
|
396
402
|
removeConnectedWalletsInfo();
|
|
397
403
|
}
|
|
398
|
-
if (!LocalStorage.getFromLS(AUTH_USER)) {
|
|
399
|
-
LocalStorage.removeFromLS(AUTH_TOKEN);
|
|
400
|
-
}
|
|
401
404
|
if (LocalStorage.getFromLS(WALLET_PICKER_SEARCH_KEY)) {
|
|
402
405
|
LocalStorage.removeFromLS(WALLET_PICKER_SEARCH_KEY);
|
|
403
406
|
}
|
|
@@ -443,6 +446,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
443
446
|
debugError,
|
|
444
447
|
decodedOnboardingOnlyToken: decodeJwt(onboardingOnlyJwt),
|
|
445
448
|
defaultNumberOfWalletsToShow,
|
|
449
|
+
defaultTabIndex,
|
|
446
450
|
desktopUri,
|
|
447
451
|
disconnectWallet,
|
|
448
452
|
displaySiweStatement,
|
|
@@ -499,6 +503,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
499
503
|
setAuthorizationViewDisplayOrder,
|
|
500
504
|
setBridgeOnboardingCompleted,
|
|
501
505
|
setCallback,
|
|
506
|
+
setDefaultTabIndex,
|
|
502
507
|
setDesktopUri,
|
|
503
508
|
setIsSingleWalletAccount,
|
|
504
509
|
setLegacyIsVerifying,
|
|
@@ -547,6 +552,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
547
552
|
handlers,
|
|
548
553
|
appLogoUrl,
|
|
549
554
|
appName,
|
|
555
|
+
defaultTabIndex,
|
|
550
556
|
authMode,
|
|
551
557
|
authorizationViewDisplayOrder,
|
|
552
558
|
awaitingSignatureState,
|
|
@@ -623,7 +629,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
623
629
|
setSelectedWalletConnectorKey,
|
|
624
630
|
setShowAuthFlow,
|
|
625
631
|
setShowQrcodeModal,
|
|
626
|
-
setUser,
|
|
627
632
|
shadowDOMEnabled,
|
|
628
633
|
showAuthFlow,
|
|
629
634
|
showBridgeWidget,
|
|
@@ -679,7 +684,8 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
679
684
|
if (user && multiWalletWidgetState !== 'idle' && !showDynamicUserProfile) {
|
|
680
685
|
setShowDynamicUserProfile(true);
|
|
681
686
|
}
|
|
682
|
-
|
|
687
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
688
|
+
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
|
|
683
689
|
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_g = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _g === void 0 ? void 0 : _g.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialView: getInitialView({
|
|
684
690
|
bridgeOnboardingCompleted,
|
|
685
691
|
connectedWallets,
|
|
@@ -6,7 +6,6 @@ import { MultiWalletWidgetStateSetter } from '../../../../utils/hooks/multiWalle
|
|
|
6
6
|
import { ChainsToConnect } from '../../types';
|
|
7
7
|
import { SetShowAuthFlow } from '../useShowAuthFlow';
|
|
8
8
|
export type UseHandleLogoutParams = {
|
|
9
|
-
removeUser: () => void;
|
|
10
9
|
clearAllWalletConnectSessions: () => void;
|
|
11
10
|
bridgeChains: ChainsToConnect[] | undefined;
|
|
12
11
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
@@ -76,6 +76,10 @@ require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/Dynami
|
|
|
76
76
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
77
77
|
require('../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
78
78
|
require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
79
|
+
require('zustand');
|
|
80
|
+
require('zustand/middleware');
|
|
81
|
+
var storeActions = require('../../../../store/actions/storeActions/storeActions.cjs');
|
|
82
|
+
require('zustand/react/shallow');
|
|
79
83
|
|
|
80
84
|
const clearFromLocalStorage = [
|
|
81
85
|
localStorage$1.AUTH_TOKEN,
|
|
@@ -124,7 +128,7 @@ const useHandleLogout = (params) => {
|
|
|
124
128
|
dynamicEvents.dynamicEvents.removeListener('embeddedWalletUpdatePasswordCompleted');
|
|
125
129
|
dynamicEvents.dynamicEvents.removeListener('embeddedWalletUpdatePasswordFailed');
|
|
126
130
|
dynamicEvents.dynamicEvents.emit('logout');
|
|
127
|
-
|
|
131
|
+
storeActions.clearStore();
|
|
128
132
|
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
129
133
|
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
130
134
|
}), []);
|
|
@@ -72,6 +72,10 @@ import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/Dynamic
|
|
|
72
72
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
73
73
|
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
74
74
|
import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
+
import 'zustand';
|
|
76
|
+
import 'zustand/middleware';
|
|
77
|
+
import { clearStore } from '../../../../store/actions/storeActions/storeActions.js';
|
|
78
|
+
import 'zustand/react/shallow';
|
|
75
79
|
|
|
76
80
|
const clearFromLocalStorage = [
|
|
77
81
|
AUTH_TOKEN,
|
|
@@ -120,7 +124,7 @@ const useHandleLogout = (params) => {
|
|
|
120
124
|
dynamicEvents.removeListener('embeddedWalletUpdatePasswordCompleted');
|
|
121
125
|
dynamicEvents.removeListener('embeddedWalletUpdatePasswordFailed');
|
|
122
126
|
dynamicEvents.emit('logout');
|
|
123
|
-
|
|
127
|
+
clearStore();
|
|
124
128
|
yield Promise.all(p.walletConnectors.map((connector) => connector.endSession()));
|
|
125
129
|
yield Promise.all(p.connectedWallets.map((connectedWallet) => connectedWallet.connector.endSession()));
|
|
126
130
|
}), []);
|
|
@@ -12,6 +12,7 @@ import { ConnectWalletOptions } from '../../../utils/hooks/useConnectWallet/useC
|
|
|
12
12
|
import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
13
13
|
import { DisplayOrder, SetDisplayOrderPriority, SetShowAuthFlow } from '../hooks';
|
|
14
14
|
import { SetCallbackType } from '../useCustomerCallbacks';
|
|
15
|
+
import { SetUserAction } from '../../../store';
|
|
15
16
|
export type ChainsToConnect = {
|
|
16
17
|
chain: Chain;
|
|
17
18
|
chainId?: number;
|
|
@@ -108,6 +109,8 @@ export interface IDynamicContext {
|
|
|
108
109
|
changeLanguage: typeof changeLanguage;
|
|
109
110
|
};
|
|
110
111
|
loginWithEmail: boolean;
|
|
112
|
+
setDefaultTabIndex: (index: number) => void;
|
|
113
|
+
defaultTabIndex: number;
|
|
111
114
|
minAuthToken: string | undefined;
|
|
112
115
|
multiWallet: boolean;
|
|
113
116
|
multiWalletWidgetState: MultiWalletWidgetState;
|
|
@@ -164,7 +167,7 @@ export interface IDynamicContext {
|
|
|
164
167
|
setShowDynamicUserProfile: Dispatch<SetStateAction<boolean>>;
|
|
165
168
|
setShowQrcodeModal: Dispatch<SetStateAction<boolean>>;
|
|
166
169
|
setShowWidgetStatePopup: Dispatch<SetStateAction<boolean>>;
|
|
167
|
-
setUser:
|
|
170
|
+
setUser: SetUserAction;
|
|
168
171
|
shadowDOMEnabled: boolean;
|
|
169
172
|
showAuthFlow: boolean;
|
|
170
173
|
/**
|
|
@@ -13,7 +13,7 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
16
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, setDefaultTabIndex, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
return {
|
|
19
19
|
accountSwitchState,
|
|
@@ -39,6 +39,7 @@ const useDynamicContext = () => {
|
|
|
39
39
|
sdkHasLoaded,
|
|
40
40
|
sendWagmiSettings,
|
|
41
41
|
setAuthMode,
|
|
42
|
+
setDefaultTabIndex,
|
|
42
43
|
setLogInWithEmail,
|
|
43
44
|
setMultiWalletWidgetState,
|
|
44
45
|
setPrimaryWallet,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken'> & {
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken' | 'setDefaultTabIndex'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,7 +9,7 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
12
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, setDefaultTabIndex, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
return {
|
|
15
15
|
accountSwitchState,
|
|
@@ -35,6 +35,7 @@ const useDynamicContext = () => {
|
|
|
35
35
|
sdkHasLoaded,
|
|
36
36
|
sendWagmiSettings,
|
|
37
37
|
setAuthMode,
|
|
38
|
+
setDefaultTabIndex,
|
|
38
39
|
setLogInWithEmail,
|
|
39
40
|
setMultiWalletWidgetState,
|
|
40
41
|
setPrimaryWallet,
|