@dynamic-labs/sdk-react-core 4.58.1 → 4.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.cjs +2 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.d.ts +1 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.js +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +4 -3
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.cjs +8 -6
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.d.ts +4 -3
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.js +8 -6
- package/src/lib/context/ReinitializeContext/index.d.ts +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/events/embeddedWallet.d.ts +2 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSetupPassword/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.cjs +157 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.d.ts +15 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.js +152 -0
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +10 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +10 -1
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.cjs +123 -0
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.d.ts +2 -0
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.js +119 -0
- package/src/lib/views/SetupPasswordForWalletCreationView/index.d.ts +1 -0
- package/src/lib/views/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/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +16 -4
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +16 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.59.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.59.0...v4.59.1) (2026-01-30)
|
|
3
|
+
|
|
4
|
+
This was a version bump only, there were no code changes.
|
|
5
|
+
|
|
6
|
+
## [4.59.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.58.1...v4.59.0) (2026-01-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add password requirement to auto-create wallet flow ([#10324](https://github.com/dynamic-labs/dynamic-auth/issues/10324)) ([f81162d](https://github.com/dynamic-labs/dynamic-auth/commit/f81162dfb8607580192d0683ed6ecb82481d97fd))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* ensure useReinitialize will load state from local storage ([#10312](https://github.com/dynamic-labs/dynamic-auth/issues/10312)) ([647ac6c](https://github.com/dynamic-labs/dynamic-auth/commit/647ac6c35a7a3a747897943b4667d63e57968227))
|
|
17
|
+
|
|
2
18
|
### [4.58.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.58.0...v4.58.1) (2026-01-29)
|
|
3
19
|
|
|
4
20
|
|
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": "4.
|
|
3
|
+
"version": "4.59.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.860",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.4.0",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"react-international-phone": "4.5.0",
|
|
17
17
|
"bs58": "5.0.0",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
19
|
-
"@dynamic-labs/iconic": "4.
|
|
20
|
-
"@dynamic-labs/locale": "4.
|
|
21
|
-
"@dynamic-labs/logger": "4.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
24
|
-
"@dynamic-labs/store": "4.
|
|
25
|
-
"@dynamic-labs/types": "4.
|
|
26
|
-
"@dynamic-labs/utils": "4.
|
|
27
|
-
"@dynamic-labs/wallet-book": "4.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.59.1",
|
|
19
|
+
"@dynamic-labs/iconic": "4.59.1",
|
|
20
|
+
"@dynamic-labs/locale": "4.59.1",
|
|
21
|
+
"@dynamic-labs/logger": "4.59.1",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "4.59.1",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "4.59.1",
|
|
24
|
+
"@dynamic-labs/store": "4.59.1",
|
|
25
|
+
"@dynamic-labs/types": "4.59.1",
|
|
26
|
+
"@dynamic-labs/utils": "4.59.1",
|
|
27
|
+
"@dynamic-labs/wallet-book": "4.59.1",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "4.59.1",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -24,7 +24,7 @@ var getApiHeaders = require('./getApiHeaders/getApiHeaders.cjs');
|
|
|
24
24
|
var syncEvents = require('./syncEvents/syncEvents.cjs');
|
|
25
25
|
|
|
26
26
|
let lastClientDependencyKey = null;
|
|
27
|
-
const useInitializeSdkClient = ({ settings, client: clientFromProps,
|
|
27
|
+
const useInitializeSdkClient = ({ settings, client: clientFromProps }, key) => {
|
|
28
28
|
/**
|
|
29
29
|
* Sets the client to the state and setup the extensions.
|
|
30
30
|
*/
|
|
@@ -47,6 +47,7 @@ const useInitializeSdkClient = ({ settings, client: clientFromProps, }) => {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
const clientDependencyKey = [
|
|
50
|
+
key,
|
|
50
51
|
settings.apiBaseUrl,
|
|
51
52
|
settings.environmentId,
|
|
52
53
|
].join('-');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DynamicContextProps } from '../../../../context/DynamicContext';
|
|
2
|
-
export declare const useInitializeSdkClient: ({ settings, client: clientFromProps
|
|
2
|
+
export declare const useInitializeSdkClient: ({ settings, client: clientFromProps }: DynamicContextProps, key: string | undefined) => void;
|
|
@@ -20,7 +20,7 @@ import { getApiHeaders } from './getApiHeaders/getApiHeaders.js';
|
|
|
20
20
|
import { syncEvents } from './syncEvents/syncEvents.js';
|
|
21
21
|
|
|
22
22
|
let lastClientDependencyKey = null;
|
|
23
|
-
const useInitializeSdkClient = ({ settings, client: clientFromProps,
|
|
23
|
+
const useInitializeSdkClient = ({ settings, client: clientFromProps }, key) => {
|
|
24
24
|
/**
|
|
25
25
|
* Sets the client to the state and setup the extensions.
|
|
26
26
|
*/
|
|
@@ -43,6 +43,7 @@ const useInitializeSdkClient = ({ settings, client: clientFromProps, }) => {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const clientDependencyKey = [
|
|
46
|
+
key,
|
|
46
47
|
settings.apiBaseUrl,
|
|
47
48
|
settings.environmentId,
|
|
48
49
|
].join('-');
|
|
@@ -741,14 +741,15 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
741
741
|
};
|
|
742
742
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
743
743
|
const DynamicContextProvider = (props) => {
|
|
744
|
+
const reinitializeState = ReinitializeContextProvider.useReinitializeState();
|
|
744
745
|
const apiBaseUrlOverride = utils.getEnvVarWithFallback('DYNAMIC_API_BASE_URL', props.settings.apiBaseUrl || '');
|
|
745
746
|
ApiEndpoint.setBaseUrl(apiBaseUrlOverride);
|
|
746
747
|
// Initialize client before anything else
|
|
747
|
-
useInitializeSdkClient.useInitializeSdkClient(props);
|
|
748
|
+
useInitializeSdkClient.useInitializeSdkClient(props, reinitializeState.key);
|
|
748
749
|
logger.Logger.setEnvironmentId(props.settings.environmentId);
|
|
749
750
|
logger.Logger.setEmitErrors(props.emitErrors);
|
|
750
751
|
useParentDynamicContextGuard.useParentDynamicContextGuard();
|
|
751
|
-
return (jsxRuntime.jsx(ReinitializeContextProvider.ReinitializeContextProvider, { onReinitialize: onReinitialize.onReinitialize, children: jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(FieldsStateContext.FieldsStateProvider, { children: jsxRuntime.jsx(IpConfigurationContext.IpConfigurationContextProvider, { children: jsxRuntime.jsx(WidgetRegistryContextProvider.WidgetRegistryContextProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
752
|
+
return (jsxRuntime.jsx(ReinitializeContextProvider.ReinitializeContextProvider, { reinitializeState: reinitializeState, onReinitialize: onReinitialize.onReinitialize, children: jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(FieldsStateContext.FieldsStateProvider, { children: jsxRuntime.jsx(IpConfigurationContext.IpConfigurationContextProvider, { children: jsxRuntime.jsx(WidgetRegistryContextProvider.WidgetRegistryContextProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
752
753
|
};
|
|
753
754
|
|
|
754
755
|
exports.DynamicContext = DynamicContext;
|
|
@@ -146,7 +146,7 @@ import { ErrorBoundary } from '../ErrorBoundary/ErrorBoundary.js';
|
|
|
146
146
|
import { ErrorBoundaryExclude } from '../ErrorBoundary/ErrorBoundaryExclude.js';
|
|
147
147
|
import '../ErrorBoundary/ErrorBoundaryBase.js';
|
|
148
148
|
import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/PhantomRedirectContext.js';
|
|
149
|
-
import { ReinitializeContextProvider } from '../ReinitializeContext/ReinitializeContextProvider.js';
|
|
149
|
+
import { useReinitializeState, ReinitializeContextProvider } from '../ReinitializeContext/ReinitializeContextProvider.js';
|
|
150
150
|
import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
|
|
151
151
|
import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
|
|
152
152
|
import { onReinitialize } from './functions/onReinitialize/onReinitialize.js';
|
|
@@ -737,14 +737,15 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
737
737
|
};
|
|
738
738
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
739
739
|
const DynamicContextProvider = (props) => {
|
|
740
|
+
const reinitializeState = useReinitializeState();
|
|
740
741
|
const apiBaseUrlOverride = getEnvVarWithFallback('DYNAMIC_API_BASE_URL', props.settings.apiBaseUrl || '');
|
|
741
742
|
ApiEndpoint.setBaseUrl(apiBaseUrlOverride);
|
|
742
743
|
// Initialize client before anything else
|
|
743
|
-
useInitializeSdkClient(props);
|
|
744
|
+
useInitializeSdkClient(props, reinitializeState.key);
|
|
744
745
|
Logger.setEnvironmentId(props.settings.environmentId);
|
|
745
746
|
Logger.setEmitErrors(props.emitErrors);
|
|
746
747
|
useParentDynamicContextGuard();
|
|
747
|
-
return (jsx(ReinitializeContextProvider, { onReinitialize: onReinitialize, children: jsx(ErrorBoundary, { children: jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(FieldsStateProvider, { children: jsx(IpConfigurationContextProvider, { children: jsx(WidgetRegistryContextProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
748
|
+
return (jsx(ReinitializeContextProvider, { reinitializeState: reinitializeState, onReinitialize: onReinitialize, children: jsx(ErrorBoundary, { children: jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(FieldsStateProvider, { children: jsx(IpConfigurationContextProvider, { children: jsx(WidgetRegistryContextProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
748
749
|
};
|
|
749
750
|
|
|
750
751
|
export { DynamicContext, DynamicContextProvider, InnerDynamicContextProvider, PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID };
|
|
@@ -31,24 +31,26 @@ require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
|
31
31
|
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
32
32
|
require('../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
33
33
|
|
|
34
|
+
const useReinitializeState = () => {
|
|
35
|
+
const [key, setKey] = React.useState();
|
|
36
|
+
return { key, setKey };
|
|
37
|
+
};
|
|
34
38
|
const reinitializeContext = React.createContext(undefined);
|
|
35
39
|
/**
|
|
36
40
|
* Provider that provides a reinitialize function to its children.
|
|
37
41
|
* @param children The children to render.
|
|
38
42
|
* @param onReinitialize A callback that is called when reinitialize is called.
|
|
39
43
|
*/
|
|
40
|
-
const ReinitializeContextProvider = ({ children, onReinitialize }) => {
|
|
41
|
-
// Initial key is undefined to not interfere on react strick mode
|
|
42
|
-
const [key, setKey] = React.useState();
|
|
44
|
+
const ReinitializeContextProvider = ({ children, onReinitialize, reinitializeState }) => {
|
|
43
45
|
const onReinitializeCallbackRef = React.useRef(onReinitialize);
|
|
44
46
|
onReinitializeCallbackRef.current = onReinitialize;
|
|
45
47
|
const reinitialize = React.useCallback(() => {
|
|
46
48
|
var _a;
|
|
47
49
|
const newKey = randomString.randomString(8);
|
|
48
50
|
(_a = onReinitializeCallbackRef.current) === null || _a === void 0 ? void 0 : _a.call(onReinitializeCallbackRef, newKey);
|
|
49
|
-
setKey(newKey);
|
|
51
|
+
reinitializeState.setKey(newKey);
|
|
50
52
|
}, []);
|
|
51
|
-
return (jsxRuntime.jsx(reinitializeContext.Provider, { value: { key, reinitialize }, children: React.cloneElement(children, { key }) }));
|
|
53
|
+
return (jsxRuntime.jsx(reinitializeContext.Provider, { value: { key: reinitializeState.key, reinitialize }, children: React.cloneElement(children, { key: reinitializeState.key }) }));
|
|
52
54
|
};
|
|
53
55
|
/**
|
|
54
56
|
* Custom hook that provides an reinitialize function for the DynamicContextProvider.
|
|
@@ -63,5 +65,5 @@ const useReinitialize = () => {
|
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
exports.ReinitializeContextProvider = ReinitializeContextProvider;
|
|
66
|
-
exports.reinitializeContext = reinitializeContext;
|
|
67
68
|
exports.useReinitialize = useReinitialize;
|
|
69
|
+
exports.useReinitializeState = useReinitializeState;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FC, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
reinitialize: () => void;
|
|
2
|
+
export declare const useReinitializeState: () => {
|
|
4
3
|
key: string | undefined;
|
|
4
|
+
setKey: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type ReinitializeState = ReturnType<typeof useReinitializeState>;
|
|
7
7
|
type ReinitializeContextProviderProps = {
|
|
8
8
|
children: ReactElement;
|
|
9
9
|
onReinitialize?: (key: string) => void;
|
|
10
|
+
reinitializeState: ReinitializeState;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Provider that provides a reinitialize function to its children.
|
|
@@ -27,24 +27,26 @@ import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
|
27
27
|
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
28
28
|
import '../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
29
29
|
|
|
30
|
+
const useReinitializeState = () => {
|
|
31
|
+
const [key, setKey] = useState();
|
|
32
|
+
return { key, setKey };
|
|
33
|
+
};
|
|
30
34
|
const reinitializeContext = createContext(undefined);
|
|
31
35
|
/**
|
|
32
36
|
* Provider that provides a reinitialize function to its children.
|
|
33
37
|
* @param children The children to render.
|
|
34
38
|
* @param onReinitialize A callback that is called when reinitialize is called.
|
|
35
39
|
*/
|
|
36
|
-
const ReinitializeContextProvider = ({ children, onReinitialize }) => {
|
|
37
|
-
// Initial key is undefined to not interfere on react strick mode
|
|
38
|
-
const [key, setKey] = useState();
|
|
40
|
+
const ReinitializeContextProvider = ({ children, onReinitialize, reinitializeState }) => {
|
|
39
41
|
const onReinitializeCallbackRef = useRef(onReinitialize);
|
|
40
42
|
onReinitializeCallbackRef.current = onReinitialize;
|
|
41
43
|
const reinitialize = useCallback(() => {
|
|
42
44
|
var _a;
|
|
43
45
|
const newKey = randomString(8);
|
|
44
46
|
(_a = onReinitializeCallbackRef.current) === null || _a === void 0 ? void 0 : _a.call(onReinitializeCallbackRef, newKey);
|
|
45
|
-
setKey(newKey);
|
|
47
|
+
reinitializeState.setKey(newKey);
|
|
46
48
|
}, []);
|
|
47
|
-
return (jsx(reinitializeContext.Provider, { value: { key, reinitialize }, children: cloneElement(children, { key }) }));
|
|
49
|
+
return (jsx(reinitializeContext.Provider, { value: { key: reinitializeState.key, reinitialize }, children: cloneElement(children, { key: reinitializeState.key }) }));
|
|
48
50
|
};
|
|
49
51
|
/**
|
|
50
52
|
* Custom hook that provides an reinitialize function for the DynamicContextProvider.
|
|
@@ -58,4 +60,4 @@ const useReinitialize = () => {
|
|
|
58
60
|
return context.reinitialize;
|
|
59
61
|
};
|
|
60
62
|
|
|
61
|
-
export { ReinitializeContextProvider,
|
|
63
|
+
export { ReinitializeContextProvider, useReinitialize, useReinitializeState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ReinitializeContextProvider, useReinitialize, } from './ReinitializeContextProvider';
|
|
1
|
+
export { ReinitializeContextProvider, useReinitialize, useReinitializeState, } from './ReinitializeContextProvider';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
2
|
import { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'access-blocked' | 'account-upgraded' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-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' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'unified-wallet-exchange-list' | 'external-funding-exchange-list' | 'external-funding-wallet-list' | 'mfa-exchange-view' | 'exchange-whitelist-warning' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'duplicate-wallet' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-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' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'passkey-setup' | 'passkey-confirm' | 'embedded-delete-view' | 'embedded-reveal-view' | 'export-shares-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'wallet-upgrade-flow-view' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists' | 'user-delete-account' | 'waas-upgrade-view' | 'wallet-delegation-view' | 'waas-backup-view' | 'waas-backup-info-view' | 'waas-backup-cloud-provider-view' | 'waas-backup-download-view' | 'waas-backup-progress-view' | 'waas-backup-success-view' | 'setup-password-terms';
|
|
3
|
+
export type ViewType = 'access-blocked' | 'account-upgraded' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-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' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'unified-wallet-exchange-list' | 'external-funding-exchange-list' | 'external-funding-wallet-list' | 'mfa-exchange-view' | 'exchange-whitelist-warning' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'duplicate-wallet' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-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' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'passkey-setup' | 'passkey-confirm' | 'embedded-delete-view' | 'embedded-reveal-view' | 'export-shares-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'wallet-upgrade-flow-view' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists' | 'user-delete-account' | 'waas-upgrade-view' | 'wallet-delegation-view' | 'waas-backup-view' | 'waas-backup-info-view' | 'waas-backup-cloud-provider-view' | 'waas-backup-download-view' | 'waas-backup-progress-view' | 'waas-backup-success-view' | 'setup-password-terms' | 'setup-password-for-wallet-creation';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
export type ViewMap = typeof viewToComponentMap;
|
|
6
6
|
export type ViewState<T extends ViewType> = {
|
|
@@ -10,4 +10,6 @@ export type EmbeddedWalletEvents = {
|
|
|
10
10
|
embeddedWalletDelegationFailed: (error: unknown) => void;
|
|
11
11
|
embeddedWalletRecoveryEmailCompleted: (email: string) => void;
|
|
12
12
|
embeddedWalletRecoveryEmailFailed: (error: unknown) => void;
|
|
13
|
+
embeddedWalletPasswordSetupCompleted: (password: string) => void;
|
|
14
|
+
embeddedWalletPasswordSetupCancelled: () => void;
|
|
13
15
|
};
|
|
@@ -99,3 +99,4 @@ export { useWalletDelegation } from './useWalletDelegation';
|
|
|
99
99
|
export { CloudBackupProvider, isWalletBackedUp, useBackupWallets, useWalletBackup, } from './useWalletBackup';
|
|
100
100
|
export type { WalletBackupStatus, WalletOperationState, WalletToBackup, WalletWithBackupStatus, } from './useWalletBackup';
|
|
101
101
|
export { useRefreshAuth } from './useRefreshAuth';
|
|
102
|
+
export { useSetupPassword, PASSWORD_SETUP_CANCELLED_ERROR, } from './useSetupPassword';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSetupPassword, PASSWORD_SETUP_CANCELLED_ERROR, } from './useSetupPassword';
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('@dynamic-labs-sdk/client/core');
|
|
9
|
+
require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('../../../client/client.cjs');
|
|
11
|
+
require('@dynamic-labs-sdk/client');
|
|
12
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
+
require('react/jsx-runtime');
|
|
16
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
|
+
require('../../../shared/logger.cjs');
|
|
18
|
+
require('@dynamic-labs/wallet-book');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
20
|
+
require('../../constants/colors.cjs');
|
|
21
|
+
require('../../constants/values.cjs');
|
|
22
|
+
require('../../../shared/consts/index.cjs');
|
|
23
|
+
require('@dynamic-labs/multi-wallet');
|
|
24
|
+
require('react-international-phone');
|
|
25
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
26
|
+
require('@dynamic-labs/locale');
|
|
27
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
+
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
31
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
32
|
+
var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
33
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
34
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
35
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
36
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
37
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
38
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
39
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
40
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
41
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
42
|
+
require('react-dom');
|
|
43
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
44
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
45
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
46
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
47
|
+
require('bs58');
|
|
48
|
+
require('@dynamic-labs/types');
|
|
49
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
50
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
51
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
52
|
+
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
53
|
+
require('yup');
|
|
54
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
55
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
56
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
57
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
58
|
+
require('@dynamic-labs/rpc-providers');
|
|
59
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
60
|
+
require('react-i18next');
|
|
61
|
+
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
62
|
+
require('../../../components/Alert/Alert.cjs');
|
|
63
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
64
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
65
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
66
|
+
require('../../../components/Input/Input.cjs');
|
|
67
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
68
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
69
|
+
require('../../../components/OverlayCard/OverlayCard.cjs');
|
|
70
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
71
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
72
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
73
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
74
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
75
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
76
|
+
require('react-focus-lock');
|
|
77
|
+
require('qrcode');
|
|
78
|
+
require('formik');
|
|
79
|
+
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
80
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
81
|
+
require('../useWalletBackup/useWalletBackup.cjs');
|
|
82
|
+
require('../useWalletBackup/types.cjs');
|
|
83
|
+
require('../useWalletBackup/cloudProviders.cjs');
|
|
84
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
85
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
86
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
87
|
+
require('@hcaptcha/react-hcaptcha');
|
|
88
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
89
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
90
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
91
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
92
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
93
|
+
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
94
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
95
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
96
|
+
require('../../../store/state/sendBalances.cjs');
|
|
97
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
|
+
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
99
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
100
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
101
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
102
|
+
require('../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
103
|
+
require('../../../../index.cjs');
|
|
104
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
105
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
106
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
107
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
108
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
109
|
+
|
|
110
|
+
const PASSWORD_SETUP_CANCELLED_ERROR = 'Password setup cancelled';
|
|
111
|
+
/**
|
|
112
|
+
* Hook to handle password setup flow before wallet creation.
|
|
113
|
+
*
|
|
114
|
+
* This hook checks if passcodeRequired is enabled in project settings,
|
|
115
|
+
* and if so, prompts the user to set up a password before creating wallets.
|
|
116
|
+
*
|
|
117
|
+
* @returns An object containing:
|
|
118
|
+
* - isPasscodeRequired: boolean indicating if password is required
|
|
119
|
+
* - setupPassword: function that shows the password setup flow and returns the password
|
|
120
|
+
*/
|
|
121
|
+
const useSetupPassword = () => {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
const projectSettings = useProjectSettings.useProjectSettings();
|
|
124
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
125
|
+
const { pushView } = ViewContext.useViewContext();
|
|
126
|
+
const isPasscodeRequired = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas) === null || _a === void 0 ? void 0 : _a.passcodeRequired) !== null && _b !== void 0 ? _b : false;
|
|
127
|
+
const setupPassword = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
if (!isPasscodeRequired) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
setShowAuthFlow(true, {
|
|
132
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
133
|
+
performMultiWalletChecks: false,
|
|
134
|
+
});
|
|
135
|
+
pushView('setup-password-for-wallet-creation');
|
|
136
|
+
return new Promise((resolve, reject) => {
|
|
137
|
+
const handleComplete = (password) => {
|
|
138
|
+
cleanup();
|
|
139
|
+
resolve(password);
|
|
140
|
+
};
|
|
141
|
+
const handleCancelled = () => {
|
|
142
|
+
cleanup();
|
|
143
|
+
reject(new Error(PASSWORD_SETUP_CANCELLED_ERROR));
|
|
144
|
+
};
|
|
145
|
+
const cleanup = () => {
|
|
146
|
+
dynamicEvents.dynamicEvents.off('embeddedWalletPasswordSetupCompleted', handleComplete);
|
|
147
|
+
dynamicEvents.dynamicEvents.off('embeddedWalletPasswordSetupCancelled', handleCancelled);
|
|
148
|
+
};
|
|
149
|
+
dynamicEvents.dynamicEvents.once('embeddedWalletPasswordSetupCompleted', handleComplete);
|
|
150
|
+
dynamicEvents.dynamicEvents.once('embeddedWalletPasswordSetupCancelled', handleCancelled);
|
|
151
|
+
});
|
|
152
|
+
}), [isPasscodeRequired, setShowAuthFlow, pushView]);
|
|
153
|
+
return { isPasscodeRequired, setupPassword };
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
exports.PASSWORD_SETUP_CANCELLED_ERROR = PASSWORD_SETUP_CANCELLED_ERROR;
|
|
157
|
+
exports.useSetupPassword = useSetupPassword;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const PASSWORD_SETUP_CANCELLED_ERROR = "Password setup cancelled";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to handle password setup flow before wallet creation.
|
|
4
|
+
*
|
|
5
|
+
* This hook checks if passcodeRequired is enabled in project settings,
|
|
6
|
+
* and if so, prompts the user to set up a password before creating wallets.
|
|
7
|
+
*
|
|
8
|
+
* @returns An object containing:
|
|
9
|
+
* - isPasscodeRequired: boolean indicating if password is required
|
|
10
|
+
* - setupPassword: function that shows the password setup flow and returns the password
|
|
11
|
+
*/
|
|
12
|
+
export declare const useSetupPassword: () => {
|
|
13
|
+
isPasscodeRequired: boolean;
|
|
14
|
+
setupPassword: () => Promise<string | undefined>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import '@dynamic-labs-sdk/client/core';
|
|
5
|
+
import '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '../../../client/client.js';
|
|
7
|
+
import '@dynamic-labs-sdk/client';
|
|
8
|
+
import '../../../config/ApiEndpoint.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import 'react/jsx-runtime';
|
|
12
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
13
|
+
import '../../../shared/logger.js';
|
|
14
|
+
import '@dynamic-labs/wallet-book';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
16
|
+
import '../../constants/colors.js';
|
|
17
|
+
import '../../constants/values.js';
|
|
18
|
+
import '../../../shared/consts/index.js';
|
|
19
|
+
import '@dynamic-labs/multi-wallet';
|
|
20
|
+
import 'react-international-phone';
|
|
21
|
+
import '../../../store/state/nonce/nonce.js';
|
|
22
|
+
import '@dynamic-labs/locale';
|
|
23
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
+
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
27
|
+
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
28
|
+
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
29
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
30
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
31
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
32
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
33
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import '../../../store/state/authMode/authMode.js';
|
|
37
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
38
|
+
import 'react-dom';
|
|
39
|
+
import '../../functions/compareChains/compareChains.js';
|
|
40
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
41
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
42
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
43
|
+
import 'bs58';
|
|
44
|
+
import '@dynamic-labs/types';
|
|
45
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
46
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
47
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
48
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
49
|
+
import 'yup';
|
|
50
|
+
import '../../../context/MockContext/MockContext.js';
|
|
51
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
52
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
53
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
54
|
+
import '@dynamic-labs/rpc-providers';
|
|
55
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
56
|
+
import 'react-i18next';
|
|
57
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
58
|
+
import '../../../components/Alert/Alert.js';
|
|
59
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
60
|
+
import '../../../components/IconButton/IconButton.js';
|
|
61
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
62
|
+
import '../../../components/Input/Input.js';
|
|
63
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
64
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
66
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
67
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
68
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
69
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
70
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
71
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
72
|
+
import 'react-focus-lock';
|
|
73
|
+
import 'qrcode';
|
|
74
|
+
import 'formik';
|
|
75
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
76
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
77
|
+
import '../useWalletBackup/useWalletBackup.js';
|
|
78
|
+
import '../useWalletBackup/types.js';
|
|
79
|
+
import '../useWalletBackup/cloudProviders.js';
|
|
80
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
81
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
82
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
83
|
+
import '@hcaptcha/react-hcaptcha';
|
|
84
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
85
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
86
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
87
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
88
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
89
|
+
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
90
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
91
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
92
|
+
import '../../../store/state/sendBalances.js';
|
|
93
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
98
|
+
import '../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
+
import '../../../../index.js';
|
|
100
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
101
|
+
import '../../../store/state/tokenBalances.js';
|
|
102
|
+
import '../../../store/state/multichainBalances.js';
|
|
103
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
105
|
+
|
|
106
|
+
const PASSWORD_SETUP_CANCELLED_ERROR = 'Password setup cancelled';
|
|
107
|
+
/**
|
|
108
|
+
* Hook to handle password setup flow before wallet creation.
|
|
109
|
+
*
|
|
110
|
+
* This hook checks if passcodeRequired is enabled in project settings,
|
|
111
|
+
* and if so, prompts the user to set up a password before creating wallets.
|
|
112
|
+
*
|
|
113
|
+
* @returns An object containing:
|
|
114
|
+
* - isPasscodeRequired: boolean indicating if password is required
|
|
115
|
+
* - setupPassword: function that shows the password setup flow and returns the password
|
|
116
|
+
*/
|
|
117
|
+
const useSetupPassword = () => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
const projectSettings = useProjectSettings();
|
|
120
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
121
|
+
const { pushView } = useViewContext();
|
|
122
|
+
const isPasscodeRequired = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas) === null || _a === void 0 ? void 0 : _a.passcodeRequired) !== null && _b !== void 0 ? _b : false;
|
|
123
|
+
const setupPassword = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
if (!isPasscodeRequired) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
setShowAuthFlow(true, {
|
|
128
|
+
ignoreIfIsEmbeddedWidget: false,
|
|
129
|
+
performMultiWalletChecks: false,
|
|
130
|
+
});
|
|
131
|
+
pushView('setup-password-for-wallet-creation');
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
const handleComplete = (password) => {
|
|
134
|
+
cleanup();
|
|
135
|
+
resolve(password);
|
|
136
|
+
};
|
|
137
|
+
const handleCancelled = () => {
|
|
138
|
+
cleanup();
|
|
139
|
+
reject(new Error(PASSWORD_SETUP_CANCELLED_ERROR));
|
|
140
|
+
};
|
|
141
|
+
const cleanup = () => {
|
|
142
|
+
dynamicEvents.off('embeddedWalletPasswordSetupCompleted', handleComplete);
|
|
143
|
+
dynamicEvents.off('embeddedWalletPasswordSetupCancelled', handleCancelled);
|
|
144
|
+
};
|
|
145
|
+
dynamicEvents.once('embeddedWalletPasswordSetupCompleted', handleComplete);
|
|
146
|
+
dynamicEvents.once('embeddedWalletPasswordSetupCancelled', handleCancelled);
|
|
147
|
+
});
|
|
148
|
+
}), [isPasscodeRequired, setShowAuthFlow, pushView]);
|
|
149
|
+
return { isPasscodeRequired, setupPassword };
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export { PASSWORD_SETUP_CANCELLED_ERROR, useSetupPassword };
|
|
@@ -110,6 +110,7 @@ require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFu
|
|
|
110
110
|
require('../../../store/state/tokenBalances.cjs');
|
|
111
111
|
require('../../../store/state/multichainBalances.cjs');
|
|
112
112
|
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
113
|
+
var useSetupPassword = require('../useSetupPassword/useSetupPassword.cjs');
|
|
113
114
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
114
115
|
|
|
115
116
|
// Validate if all required conditions are met for wallet creation
|
|
@@ -141,6 +142,7 @@ const useWalletCreation = () => {
|
|
|
141
142
|
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
142
143
|
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
143
144
|
const { createWalletAccount } = useDynamicWaas.useDynamicWaas();
|
|
145
|
+
const { setupPassword } = useSetupPassword.useSetupPassword();
|
|
144
146
|
const user = useOnboardingCompleteUser.useOnboardingCompleteUser();
|
|
145
147
|
const environmentId = dynamicContextProps.useEnvironmentId();
|
|
146
148
|
return useMutation.useMutation((requirements) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -156,7 +158,9 @@ const useWalletCreation = () => {
|
|
|
156
158
|
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
157
159
|
});
|
|
158
160
|
try {
|
|
159
|
-
|
|
161
|
+
// If passcodeRequired is enabled, prompt user to set up password first
|
|
162
|
+
const password = yield setupPassword();
|
|
163
|
+
yield createWalletAccount(requirements, password);
|
|
160
164
|
const duration = Date.now() - startTime;
|
|
161
165
|
// Log successful wallet creation to DataDog
|
|
162
166
|
logger.logger.instrument('Auto wallet creation successful', {
|
|
@@ -183,6 +187,11 @@ const useWalletCreation = () => {
|
|
|
183
187
|
}
|
|
184
188
|
}), {
|
|
185
189
|
onFailure: (error) => {
|
|
190
|
+
// Don't show error view if user cancelled password setup
|
|
191
|
+
if (error.message === useSetupPassword.PASSWORD_SETUP_CANCELLED_ERROR) {
|
|
192
|
+
logger.logger.debug('Password setup cancelled by user');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
186
195
|
logger.logger.error('Error creating dynamic waas wallet', error);
|
|
187
196
|
setShowAuthFlow(true);
|
|
188
197
|
clearStackAndPush('backup-unsuccessful');
|
|
@@ -106,6 +106,7 @@ import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFun
|
|
|
106
106
|
import '../../../store/state/tokenBalances.js';
|
|
107
107
|
import '../../../store/state/multichainBalances.js';
|
|
108
108
|
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
109
|
+
import { useSetupPassword, PASSWORD_SETUP_CANCELLED_ERROR } from '../useSetupPassword/useSetupPassword.js';
|
|
109
110
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
110
111
|
|
|
111
112
|
// Validate if all required conditions are met for wallet creation
|
|
@@ -137,6 +138,7 @@ const useWalletCreation = () => {
|
|
|
137
138
|
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
138
139
|
const { clearStackAndPush } = useViewContext();
|
|
139
140
|
const { createWalletAccount } = useDynamicWaas();
|
|
141
|
+
const { setupPassword } = useSetupPassword();
|
|
140
142
|
const user = useOnboardingCompleteUser();
|
|
141
143
|
const environmentId = useEnvironmentId();
|
|
142
144
|
return useMutation((requirements) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -152,7 +154,9 @@ const useWalletCreation = () => {
|
|
|
152
154
|
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
153
155
|
});
|
|
154
156
|
try {
|
|
155
|
-
|
|
157
|
+
// If passcodeRequired is enabled, prompt user to set up password first
|
|
158
|
+
const password = yield setupPassword();
|
|
159
|
+
yield createWalletAccount(requirements, password);
|
|
156
160
|
const duration = Date.now() - startTime;
|
|
157
161
|
// Log successful wallet creation to DataDog
|
|
158
162
|
logger.instrument('Auto wallet creation successful', {
|
|
@@ -179,6 +183,11 @@ const useWalletCreation = () => {
|
|
|
179
183
|
}
|
|
180
184
|
}), {
|
|
181
185
|
onFailure: (error) => {
|
|
186
|
+
// Don't show error view if user cancelled password setup
|
|
187
|
+
if (error.message === PASSWORD_SETUP_CANCELLED_ERROR) {
|
|
188
|
+
logger.debug('Password setup cancelled by user');
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
182
191
|
logger.error('Error creating dynamic waas wallet', error);
|
|
183
192
|
setShowAuthFlow(true);
|
|
184
193
|
clearStackAndPush('backup-unsuccessful');
|
package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.cjs
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
9
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('../../shared/logger.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
require('@dynamic-labs/utils');
|
|
16
|
+
require('../../utils/constants/colors.cjs');
|
|
17
|
+
require('../../utils/constants/values.cjs');
|
|
18
|
+
require('@dynamic-labs/sdk-api-core');
|
|
19
|
+
require('../../shared/consts/index.cjs');
|
|
20
|
+
var dynamicEvents = require('../../events/dynamicEvents.cjs');
|
|
21
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
22
|
+
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
|
+
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
require('react-international-phone');
|
|
26
|
+
require('../../store/state/nonce/nonce.cjs');
|
|
27
|
+
require('@dynamic-labs-sdk/client/core');
|
|
28
|
+
require('../../client/client.cjs');
|
|
29
|
+
require('@dynamic-labs-sdk/client');
|
|
30
|
+
require('../../config/ApiEndpoint.cjs');
|
|
31
|
+
require('@dynamic-labs/locale');
|
|
32
|
+
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
|
+
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
|
+
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
35
|
+
require('../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
36
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
39
|
+
require('../../store/state/authMode/authMode.cjs');
|
|
40
|
+
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
43
|
+
require('../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
44
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
45
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
46
|
+
require('bs58');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
49
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
50
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
51
|
+
require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
52
|
+
require('yup');
|
|
53
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
54
|
+
require('../CollectUserDataView/useFields.cjs');
|
|
55
|
+
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
56
|
+
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
|
+
require('@dynamic-labs/rpc-providers');
|
|
58
|
+
require('../../store/state/walletOptions/walletOptions.cjs');
|
|
59
|
+
require('react-i18next');
|
|
60
|
+
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
61
|
+
require('../../components/Alert/Alert.cjs');
|
|
62
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
63
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
64
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
65
|
+
require('../../components/Input/Input.cjs');
|
|
66
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
67
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
|
+
require('../../components/OverlayCard/OverlayCard.cjs');
|
|
69
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
70
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
71
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
72
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
73
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
74
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
75
|
+
require('react-focus-lock');
|
|
76
|
+
require('qrcode');
|
|
77
|
+
require('formik');
|
|
78
|
+
require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
81
|
+
require('../../utils/hooks/useWalletBackup/types.cjs');
|
|
82
|
+
require('../../utils/hooks/useWalletBackup/cloudProviders.cjs');
|
|
83
|
+
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
84
|
+
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
85
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
86
|
+
require('@hcaptcha/react-hcaptcha');
|
|
87
|
+
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
88
|
+
require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
89
|
+
require('../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
90
|
+
require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
91
|
+
require('../../context/FooterAnimationContext/index.cjs');
|
|
92
|
+
require('../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
93
|
+
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
|
+
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
95
|
+
var SetupPasswordView = require('../../widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs');
|
|
96
|
+
require('../../store/state/sendBalances.cjs');
|
|
97
|
+
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
|
+
require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
99
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
100
|
+
require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
101
|
+
require('../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
102
|
+
require('../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
103
|
+
require('../../../index.cjs');
|
|
104
|
+
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
105
|
+
require('../../store/state/tokenBalances.cjs');
|
|
106
|
+
require('../../store/state/multichainBalances.cjs');
|
|
107
|
+
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
108
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
109
|
+
|
|
110
|
+
const SetupPasswordForWalletCreationView = () => {
|
|
111
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
112
|
+
const handleCancel = React.useCallback(() => {
|
|
113
|
+
dynamicEvents.dynamicEvents.emit('embeddedWalletPasswordSetupCancelled');
|
|
114
|
+
setShowAuthFlow(false);
|
|
115
|
+
}, [setShowAuthFlow]);
|
|
116
|
+
const handleComplete = React.useCallback((password) => {
|
|
117
|
+
dynamicEvents.dynamicEvents.emit('embeddedWalletPasswordSetupCompleted', password);
|
|
118
|
+
setShowAuthFlow(false);
|
|
119
|
+
}, [setShowAuthFlow]);
|
|
120
|
+
return (jsxRuntime.jsx(SetupPasswordView.SetupPasswordView, { onComplete: handleComplete, onCancel: handleCancel }));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
exports.SetupPasswordForWalletCreationView = SetupPasswordForWalletCreationView;
|
package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
5
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import '../../shared/logger.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '@dynamic-labs/utils';
|
|
12
|
+
import '../../utils/constants/colors.js';
|
|
13
|
+
import '../../utils/constants/values.js';
|
|
14
|
+
import '@dynamic-labs/sdk-api-core';
|
|
15
|
+
import '../../shared/consts/index.js';
|
|
16
|
+
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
17
|
+
import '../../../../_virtual/_tslib.js';
|
|
18
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import 'react-international-phone';
|
|
22
|
+
import '../../store/state/nonce/nonce.js';
|
|
23
|
+
import '@dynamic-labs-sdk/client/core';
|
|
24
|
+
import '../../client/client.js';
|
|
25
|
+
import '@dynamic-labs-sdk/client';
|
|
26
|
+
import '../../config/ApiEndpoint.js';
|
|
27
|
+
import '@dynamic-labs/locale';
|
|
28
|
+
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
29
|
+
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
30
|
+
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
31
|
+
import '../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
32
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
35
|
+
import '../../store/state/authMode/authMode.js';
|
|
36
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
37
|
+
import 'react-dom';
|
|
38
|
+
import '../../utils/functions/compareChains/compareChains.js';
|
|
39
|
+
import '../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
40
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
41
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
42
|
+
import 'bs58';
|
|
43
|
+
import '@dynamic-labs/types';
|
|
44
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
45
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
46
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
47
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
48
|
+
import 'yup';
|
|
49
|
+
import '../../context/MockContext/MockContext.js';
|
|
50
|
+
import '../CollectUserDataView/useFields.js';
|
|
51
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
52
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
|
+
import '@dynamic-labs/rpc-providers';
|
|
54
|
+
import '../../store/state/walletOptions/walletOptions.js';
|
|
55
|
+
import 'react-i18next';
|
|
56
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
57
|
+
import '../../components/Alert/Alert.js';
|
|
58
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
59
|
+
import '../../components/IconButton/IconButton.js';
|
|
60
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
61
|
+
import '../../components/Input/Input.js';
|
|
62
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
63
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
64
|
+
import '../../components/OverlayCard/OverlayCard.js';
|
|
65
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
66
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
67
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
68
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
69
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
70
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
71
|
+
import 'react-focus-lock';
|
|
72
|
+
import 'qrcode';
|
|
73
|
+
import 'formik';
|
|
74
|
+
import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
75
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import '../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
77
|
+
import '../../utils/hooks/useWalletBackup/types.js';
|
|
78
|
+
import '../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
79
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
80
|
+
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
81
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
82
|
+
import '@hcaptcha/react-hcaptcha';
|
|
83
|
+
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
84
|
+
import '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
85
|
+
import '../ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
86
|
+
import '../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
87
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
88
|
+
import '../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
89
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
90
|
+
import '../../context/OnrampContext/OnrampContext.js';
|
|
91
|
+
import { SetupPasswordView } from '../../widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js';
|
|
92
|
+
import '../../store/state/sendBalances.js';
|
|
93
|
+
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
|
+
import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
|
+
import '../TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
|
+
import '../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
98
|
+
import '../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
+
import '../../../index.js';
|
|
100
|
+
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
101
|
+
import '../../store/state/tokenBalances.js';
|
|
102
|
+
import '../../store/state/multichainBalances.js';
|
|
103
|
+
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
105
|
+
|
|
106
|
+
const SetupPasswordForWalletCreationView = () => {
|
|
107
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
108
|
+
const handleCancel = useCallback(() => {
|
|
109
|
+
dynamicEvents.emit('embeddedWalletPasswordSetupCancelled');
|
|
110
|
+
setShowAuthFlow(false);
|
|
111
|
+
}, [setShowAuthFlow]);
|
|
112
|
+
const handleComplete = useCallback((password) => {
|
|
113
|
+
dynamicEvents.emit('embeddedWalletPasswordSetupCompleted', password);
|
|
114
|
+
setShowAuthFlow(false);
|
|
115
|
+
}, [setShowAuthFlow]);
|
|
116
|
+
return (jsx(SetupPasswordView, { onComplete: handleComplete, onCancel: handleCancel }));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export { SetupPasswordForWalletCreationView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SetupPasswordForWalletCreationView } from './SetupPasswordForWalletCreationView';
|
package/src/lib/views/index.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export { FarcasterConnectView } from './FarcasterConnectView';
|
|
|
10
10
|
export { AddNetworkView } from './AddNetworkView';
|
|
11
11
|
export { NetworkNotSupportedSwitchManual } from './NetworkNotSupportedSwitchManual';
|
|
12
12
|
export { viewToComponentMap } from './viewToComponentMap';
|
|
13
|
+
export { SetupPasswordForWalletCreationView } from './SetupPasswordForWalletCreationView';
|
|
@@ -166,6 +166,7 @@ var WalletRedirectView = require('./WalletRedirectView/WalletRedirectView.cjs');
|
|
|
166
166
|
var WalletSignSpinnerView = require('./WalletSignSpinnerView/WalletSignSpinnerView.cjs');
|
|
167
167
|
var WalletUpgradeFlowView = require('./WalletUpgradeFlowView/WalletUpgradeFlowView.cjs');
|
|
168
168
|
var WalletUsedView = require('./WalletUsedView/WalletUsedView.cjs');
|
|
169
|
+
var SetupPasswordForWalletCreationView = require('./SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.cjs');
|
|
169
170
|
require('../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
170
171
|
require('../store/state/tokenBalances.cjs');
|
|
171
172
|
require('../store/state/multichainBalances.cjs');
|
|
@@ -241,6 +242,7 @@ const viewToComponentMap = {
|
|
|
241
242
|
'sandbox-maximum-threshold-reached': SandboxMaximumThresholdReached.SandboxMaximumThresholdReached,
|
|
242
243
|
'select-hardware-wallet': SelectHardwareWalletView.SelectHardwareWalletView,
|
|
243
244
|
'select-wallet-in-wallet-group': SelectWalletInWalletGroupView.SelectWalletInWalletGroupView,
|
|
245
|
+
'setup-password-for-wallet-creation': SetupPasswordForWalletCreationView.SetupPasswordForWalletCreationView,
|
|
244
246
|
'setup-password-terms': SetupPasswordTermsView.SetupPasswordTermsView,
|
|
245
247
|
'social-redirect-view': SocialRedirectView.SocialRedirectView,
|
|
246
248
|
'social-wrong-account': SocialWrongAccountView.SocialWrongAccountView,
|
|
@@ -100,6 +100,7 @@ export declare const viewToComponentMap: {
|
|
|
100
100
|
'select-wallet-in-wallet-group': import("react").FC<{
|
|
101
101
|
onSelectWallet: (wallet: import("../shared").WalletOption) => void;
|
|
102
102
|
}>;
|
|
103
|
+
'setup-password-for-wallet-creation': import("react").FC;
|
|
103
104
|
'setup-password-terms': import("react").FC<import("../widgets/DynamicWidget/views/SetupPasswordTermsView").SetupPasswordTermsViewProps>;
|
|
104
105
|
'social-redirect-view': () => JSX.Element;
|
|
105
106
|
'social-wrong-account': () => JSX.Element | null;
|
|
@@ -162,6 +162,7 @@ import { WalletRedirectView } from './WalletRedirectView/WalletRedirectView.js';
|
|
|
162
162
|
import { WalletSignSpinnerView } from './WalletSignSpinnerView/WalletSignSpinnerView.js';
|
|
163
163
|
import { WalletUpgradeFlowView } from './WalletUpgradeFlowView/WalletUpgradeFlowView.js';
|
|
164
164
|
import { WalletUsedView } from './WalletUsedView/WalletUsedView.js';
|
|
165
|
+
import { SetupPasswordForWalletCreationView } from './SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.js';
|
|
165
166
|
import '../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
166
167
|
import '../store/state/tokenBalances.js';
|
|
167
168
|
import '../store/state/multichainBalances.js';
|
|
@@ -237,6 +238,7 @@ const viewToComponentMap = {
|
|
|
237
238
|
'sandbox-maximum-threshold-reached': SandboxMaximumThresholdReached,
|
|
238
239
|
'select-hardware-wallet': SelectHardwareWalletView,
|
|
239
240
|
'select-wallet-in-wallet-group': SelectWalletInWalletGroupView,
|
|
241
|
+
'setup-password-for-wallet-creation': SetupPasswordForWalletCreationView,
|
|
240
242
|
'setup-password-terms': SetupPasswordTermsView,
|
|
241
243
|
'social-redirect-view': SocialRedirectView,
|
|
242
244
|
'social-wrong-account': SocialWrongAccountView,
|
|
@@ -16,13 +16,21 @@ var SetupPasswordConfirmView = require('../SetupPasswordConfirmView/SetupPasswor
|
|
|
16
16
|
var SetupPasswordKnowledgeCheckView = require('../SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs');
|
|
17
17
|
var SetupPasswordSuccessView = require('../SetupPasswordSuccessView/SetupPasswordSuccessView.cjs');
|
|
18
18
|
|
|
19
|
-
const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
19
|
+
const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }) => {
|
|
20
20
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
21
21
|
const [currentStep, setCurrentStep] = React.useState('terms');
|
|
22
22
|
const [password, setPassword] = React.useState('');
|
|
23
23
|
const goToAccountAndSecurity = React.useCallback(() => {
|
|
24
24
|
setDynamicWidgetView('account-and-security-settings');
|
|
25
25
|
}, [setDynamicWidgetView]);
|
|
26
|
+
const handleCancel = React.useCallback(() => {
|
|
27
|
+
if (onCancel) {
|
|
28
|
+
onCancel();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
goToAccountAndSecurity();
|
|
32
|
+
}
|
|
33
|
+
}, [onCancel, goToAccountAndSecurity]);
|
|
26
34
|
const handleTermsContinue = React.useCallback(() => {
|
|
27
35
|
setCurrentStep('enter');
|
|
28
36
|
}, []);
|
|
@@ -55,11 +63,15 @@ const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
|
55
63
|
}, []);
|
|
56
64
|
const handleSuccess = React.useCallback(() => {
|
|
57
65
|
onComplete(password);
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
// Only navigate to account settings if onCancel wasn't provided
|
|
67
|
+
// (i.e., the caller isn't handling navigation themselves)
|
|
68
|
+
if (!onCancel) {
|
|
69
|
+
goToAccountAndSecurity();
|
|
70
|
+
}
|
|
71
|
+
}, [onComplete, password, onCancel, goToAccountAndSecurity]);
|
|
60
72
|
switch (currentStep) {
|
|
61
73
|
case 'terms':
|
|
62
|
-
return (jsxRuntime.jsx(SetupPasswordTermsView.SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack:
|
|
74
|
+
return (jsxRuntime.jsx(SetupPasswordTermsView.SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: handleCancel }));
|
|
63
75
|
case 'enter':
|
|
64
76
|
return (jsxRuntime.jsx(SetupPasswordEnterView.SetupPasswordEnterView, { onContinue: handleEnterContinue, onBack: handleEnterBack }));
|
|
65
77
|
case 'confirm':
|
|
@@ -12,13 +12,21 @@ import { SetupPasswordConfirmView } from '../SetupPasswordConfirmView/SetupPassw
|
|
|
12
12
|
import { SetupPasswordKnowledgeCheckView } from '../SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js';
|
|
13
13
|
import { SetupPasswordSuccessView } from '../SetupPasswordSuccessView/SetupPasswordSuccessView.js';
|
|
14
14
|
|
|
15
|
-
const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
15
|
+
const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }) => {
|
|
16
16
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
17
17
|
const [currentStep, setCurrentStep] = useState('terms');
|
|
18
18
|
const [password, setPassword] = useState('');
|
|
19
19
|
const goToAccountAndSecurity = useCallback(() => {
|
|
20
20
|
setDynamicWidgetView('account-and-security-settings');
|
|
21
21
|
}, [setDynamicWidgetView]);
|
|
22
|
+
const handleCancel = useCallback(() => {
|
|
23
|
+
if (onCancel) {
|
|
24
|
+
onCancel();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
goToAccountAndSecurity();
|
|
28
|
+
}
|
|
29
|
+
}, [onCancel, goToAccountAndSecurity]);
|
|
22
30
|
const handleTermsContinue = useCallback(() => {
|
|
23
31
|
setCurrentStep('enter');
|
|
24
32
|
}, []);
|
|
@@ -51,11 +59,15 @@ const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
|
51
59
|
}, []);
|
|
52
60
|
const handleSuccess = useCallback(() => {
|
|
53
61
|
onComplete(password);
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
// Only navigate to account settings if onCancel wasn't provided
|
|
63
|
+
// (i.e., the caller isn't handling navigation themselves)
|
|
64
|
+
if (!onCancel) {
|
|
65
|
+
goToAccountAndSecurity();
|
|
66
|
+
}
|
|
67
|
+
}, [onComplete, password, onCancel, goToAccountAndSecurity]);
|
|
56
68
|
switch (currentStep) {
|
|
57
69
|
case 'terms':
|
|
58
|
-
return (jsx(SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack:
|
|
70
|
+
return (jsx(SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: handleCancel }));
|
|
59
71
|
case 'enter':
|
|
60
72
|
return (jsx(SetupPasswordEnterView, { onContinue: handleEnterContinue, onBack: handleEnterBack }));
|
|
61
73
|
case 'confirm':
|