@dynamic-labs/sdk-react-core 1.1.0-alpha.4 → 1.1.0-alpha.5

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +10 -10
  5. package/src/index.cjs +14 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +7 -0
  8. package/src/lib/components/index.d.ts +1 -0
  9. package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
  10. package/src/lib/data/api.cjs +15 -0
  11. package/src/lib/data/api.d.ts +7 -1
  12. package/src/lib/data/api.js +15 -1
  13. package/src/lib/events/dynamicEvents.d.ts +2 -0
  14. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +1 -0
  15. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +2 -1
  16. package/src/lib/locale/en/translation.cjs +71 -1
  17. package/src/lib/locale/en/translation.d.ts +70 -0
  18. package/src/lib/locale/en/translation.js +71 -1
  19. package/src/lib/shared/assets/alt-embedded-wallet.cjs +54 -0
  20. package/src/lib/shared/assets/alt-embedded-wallet.js +30 -0
  21. package/src/lib/shared/assets/export-embedded-hero.cjs +90 -0
  22. package/src/lib/shared/assets/export-embedded-hero.js +66 -0
  23. package/src/lib/shared/assets/eye-off-icon.cjs +53 -0
  24. package/src/lib/shared/assets/eye-off-icon.js +29 -0
  25. package/src/lib/shared/assets/face-id.cjs +53 -0
  26. package/src/lib/shared/assets/face-id.js +29 -0
  27. package/src/lib/shared/assets/index.d.ts +6 -0
  28. package/src/lib/shared/assets/lock.cjs +54 -0
  29. package/src/lib/shared/assets/lock.js +30 -0
  30. package/src/lib/shared/assets/wallet-v2.cjs +53 -0
  31. package/src/lib/shared/assets/wallet-v2.js +29 -0
  32. package/src/lib/styles/index.shadow.cjs +1 -1
  33. package/src/lib/styles/index.shadow.js +1 -1
  34. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +28 -1
  35. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +28 -1
  36. package/src/lib/utils/hooks/index.d.ts +1 -0
  37. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
  38. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
  39. package/src/lib/utils/hooks/useEmbeddedReveal/index.d.ts +1 -0
  40. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +60 -0
  41. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.d.ts +4 -0
  42. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +56 -0
  43. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +3 -0
  44. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +3 -0
  45. package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +2 -27
  46. package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +2 -27
  47. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +20 -14
  48. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +20 -14
  49. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +26 -4
  50. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +26 -4
  51. package/src/lib/views/EmailVerification/EmailVerification.cjs +34 -23
  52. package/src/lib/views/EmailVerification/EmailVerification.js +34 -23
  53. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +158 -0
  54. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +2 -0
  55. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +154 -0
  56. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/index.d.ts +1 -0
  57. package/src/lib/views/EmbeddedReveal/constants.cjs +9 -0
  58. package/src/lib/views/EmbeddedReveal/constants.d.ts +2 -0
  59. package/src/lib/views/EmbeddedReveal/constants.js +4 -0
  60. package/src/lib/views/EmbeddedReveal/index.d.ts +1 -0
  61. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/index.d.ts +1 -0
  62. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +114 -0
  63. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +15 -0
  64. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +108 -0
  65. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +2 -2
  66. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +2 -2
  67. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +2 -2
  68. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -2
  69. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +2 -2
  70. package/src/lib/views/viewToComponentMap.cjs +2 -0
  71. package/src/lib/views/viewToComponentMap.js +2 -0
  72. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -2
  73. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -2
  74. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.cjs +2 -0
  75. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.js +2 -0
  76. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.cjs +2 -0
  77. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +3 -1
  78. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.js +2 -1
  79. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +4 -4
  80. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +4 -4
  81. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +93 -0
  82. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.d.ts +2 -0
  83. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +89 -0
  84. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/index.d.ts +1 -0
  85. package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
@@ -0,0 +1,108 @@
1
+ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
2
+ import { isPasskeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
3
+ import { DynamicError } from '@dynamic-labs/utils';
4
+ import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
5
+ import '@dynamic-labs/iconic';
6
+ import 'react/jsx-runtime';
7
+ import '../../../../context/ViewContext/ViewContext.js';
8
+ import 'react';
9
+ import '../../../../shared/logger.js';
10
+ import '@dynamic-labs/wallet-book';
11
+ import '../../../../utils/constants/colors.js';
12
+ import '../../../../shared/utils/classes/storage/localStorage.js';
13
+ import 'viem';
14
+ import '../../../../shared/consts/index.js';
15
+ import { exportEmbeddedWallet } from '../../../../data/api.js';
16
+
17
+ const initExport = ({ iframeContainer, iframeElementId, wallet, }) => __awaiter(void 0, void 0, void 0, function* () {
18
+ var _a;
19
+ if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
20
+ !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
21
+ !isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
22
+ throw new DynamicError('PasskeyWalletConnector not found');
23
+ }
24
+ const turnkeyExportHandler = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.getExportHandler();
25
+ const publicKey = yield turnkeyExportHandler.initExport(iframeContainer, iframeElementId);
26
+ if (!publicKey) {
27
+ throw new DynamicError('Something went wrong');
28
+ }
29
+ return turnkeyExportHandler;
30
+ });
31
+ const exportCredential = ({ authToken, userEmail, wallet, environmentId, }) => __awaiter(void 0, void 0, void 0, function* () {
32
+ var _b, _c;
33
+ if (!authToken) {
34
+ throw new DynamicError('User must be logged in');
35
+ }
36
+ const decodedJwt = decodeJwt(authToken);
37
+ if (!decodedJwt) {
38
+ throw new DynamicError('User must be logged in with a valid token');
39
+ }
40
+ if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
41
+ !(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
42
+ !isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
43
+ throw new DynamicError('PasskeyWalletConnector not found');
44
+ }
45
+ const connector = wallet.connector;
46
+ connector.setEmail(userEmail);
47
+ const walletProperties = (_c = (_b = decodedJwt.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _c === void 0 ? void 0 : _c.walletProperties;
48
+ const turnkeyHDWalletId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
49
+ const privateKeyId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyPrivateKeyId;
50
+ const organizationId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId;
51
+ if (!organizationId ||
52
+ (turnkeyHDWalletId === undefined && privateKeyId === undefined)) {
53
+ throw new DynamicError('Invalid token!');
54
+ }
55
+ const turnkeyExportHandler = connector.getExportHandler();
56
+ const targetPublicKey = turnkeyExportHandler.publicKey;
57
+ if (!targetPublicKey) {
58
+ throw new DynamicError('Must initialize export first');
59
+ }
60
+ // calls turnkey export api
61
+ if (turnkeyHDWalletId) {
62
+ const newActivity = yield turnkeyExportHandler.exportWallet({
63
+ organizationId,
64
+ walletId: turnkeyHDWalletId,
65
+ });
66
+ const activityId = newActivity.id;
67
+ const res = yield exportEmbeddedWallet({
68
+ activityId,
69
+ environmentId,
70
+ userJwt: authToken,
71
+ walletId: wallet.id,
72
+ });
73
+ const exportBundle = res === null || res === void 0 ? void 0 : res.exportBundle;
74
+ if (!exportBundle) {
75
+ throw new DynamicError('Invalid export response');
76
+ }
77
+ const injected = yield turnkeyExportHandler.verifyExportWallet(exportBundle);
78
+ return injected;
79
+ }
80
+ else if (privateKeyId) {
81
+ const newActivity = yield turnkeyExportHandler.exportPrivateKey({
82
+ organizationId,
83
+ privateKeyId,
84
+ });
85
+ const activityId = newActivity.id;
86
+ const res = yield exportEmbeddedWallet({
87
+ activityId,
88
+ environmentId,
89
+ userJwt: authToken,
90
+ walletId: wallet.id,
91
+ });
92
+ const exportBundle = res === null || res === void 0 ? void 0 : res.exportBundle;
93
+ if (!exportBundle) {
94
+ throw new DynamicError('Invalid export response');
95
+ }
96
+ const injected = yield turnkeyExportHandler.verifyExportPrivateKey(exportBundle);
97
+ return injected;
98
+ }
99
+ throw new DynamicError('Invalid token!');
100
+ });
101
+ const cleanupExport = ({ wallet }) => __awaiter(void 0, void 0, void 0, function* () {
102
+ var _d;
103
+ const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
104
+ // clear iframeStamper and its reference
105
+ (_d = connector === null || connector === void 0 ? void 0 : connector.getExportHandler()) === null || _d === void 0 ? void 0 : _d.clear();
106
+ });
107
+
108
+ export { cleanupExport, exportCredential, initExport };
@@ -80,7 +80,7 @@ const PasskeyInitRecovery = () => {
80
80
  const { authToken, primaryWallet, environmentId, setShowAuthFlow, user } = useInternalDynamicContext.useInternalDynamicContext();
81
81
  const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
82
82
  const { setView } = ViewContext.useViewContext();
83
- useElementById.useElementById(constants.iframeContainerId);
83
+ const iframeContainerRef = useElementById.useElementById(constants.iframeContainerId);
84
84
  const { t } = reactI18next.useTranslation();
85
85
  const { mutate: initRecovery, isLoading, error, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
86
86
  const wallet = isAccountAbstractionWallet.isAccountAbstractionWallet(primaryWallet)
@@ -89,7 +89,7 @@ const PasskeyInitRecovery = () => {
89
89
  yield passkeyRecovery.initPasskeyRecovery({
90
90
  authToken,
91
91
  environmentId,
92
- iframeContainerId: constants.iframeContainerId,
92
+ iframeContainer: iframeContainerRef.current,
93
93
  iframeElementId: constants.iframeElementId,
94
94
  wallet,
95
95
  });
@@ -76,7 +76,7 @@ const PasskeyInitRecovery = () => {
76
76
  const { authToken, primaryWallet, environmentId, setShowAuthFlow, user } = useInternalDynamicContext();
77
77
  const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
78
78
  const { setView } = useViewContext();
79
- useElementById(iframeContainerId);
79
+ const iframeContainerRef = useElementById(iframeContainerId);
80
80
  const { t } = useTranslation();
81
81
  const { mutate: initRecovery, isLoading, error, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
82
82
  const wallet = isAccountAbstractionWallet(primaryWallet)
@@ -85,7 +85,7 @@ const PasskeyInitRecovery = () => {
85
85
  yield initPasskeyRecovery({
86
86
  authToken,
87
87
  environmentId,
88
- iframeContainerId,
88
+ iframeContainer: iframeContainerRef.current,
89
89
  iframeElementId,
90
90
  wallet,
91
91
  });
@@ -23,7 +23,7 @@ require('@dynamic-labs/sdk-api');
23
23
  var removeElementById = require('../../../../utils/functions/removeElementById/removeElementById.cjs');
24
24
  var constants = require('../../PasskeyRecovery/constants.cjs');
25
25
 
26
- const initPasskeyRecovery = ({ authToken, iframeContainerId, iframeElementId, environmentId, wallet, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
26
+ const initPasskeyRecovery = ({ authToken, iframeContainer, iframeElementId, environmentId, wallet, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
27
27
  var _a;
28
28
  if (!authToken) {
29
29
  throw new utils.DynamicError('Auth token is not defined');
@@ -34,7 +34,7 @@ const initPasskeyRecovery = ({ authToken, iframeContainerId, iframeElementId, en
34
34
  throw new utils.DynamicError('PasskeyWalletConnector not found');
35
35
  }
36
36
  const turnkeyRecoveryHandler = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.getRecoverPasskeyHandler();
37
- const publicKey = yield turnkeyRecoveryHandler.initRecovery(iframeContainerId, iframeElementId);
37
+ const publicKey = yield turnkeyRecoveryHandler.initRecovery(iframeContainer, iframeElementId);
38
38
  if (!publicKey) {
39
39
  throw new utils.DynamicError('Something went wrong');
40
40
  }
@@ -1,7 +1,7 @@
1
1
  import { Wallet } from '../../../../shared';
2
- export declare const initPasskeyRecovery: ({ authToken, iframeContainerId, iframeElementId, environmentId, wallet, }: {
2
+ export declare const initPasskeyRecovery: ({ authToken, iframeContainer, iframeElementId, environmentId, wallet, }: {
3
3
  authToken: string | undefined;
4
- iframeContainerId: string;
4
+ iframeContainer: HTMLElement;
5
5
  iframeElementId: string;
6
6
  environmentId: string;
7
7
  wallet: Wallet | null;
@@ -19,7 +19,7 @@ import '@dynamic-labs/sdk-api';
19
19
  import { removeElementById } from '../../../../utils/functions/removeElementById/removeElementById.js';
20
20
  import { iframeContainerId } from '../../PasskeyRecovery/constants.js';
21
21
 
22
- const initPasskeyRecovery = ({ authToken, iframeContainerId, iframeElementId, environmentId, wallet, }) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const initPasskeyRecovery = ({ authToken, iframeContainer, iframeElementId, environmentId, wallet, }) => __awaiter(void 0, void 0, void 0, function* () {
23
23
  var _a;
24
24
  if (!authToken) {
25
25
  throw new DynamicError('Auth token is not defined');
@@ -30,7 +30,7 @@ const initPasskeyRecovery = ({ authToken, iframeContainerId, iframeElementId, en
30
30
  throw new DynamicError('PasskeyWalletConnector not found');
31
31
  }
32
32
  const turnkeyRecoveryHandler = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.getRecoverPasskeyHandler();
33
- const publicKey = yield turnkeyRecoveryHandler.initRecovery(iframeContainerId, iframeElementId);
33
+ const publicKey = yield turnkeyRecoveryHandler.initRecovery(iframeContainer, iframeElementId);
34
34
  if (!publicKey) {
35
35
  throw new DynamicError('Something went wrong');
36
36
  }
@@ -35,6 +35,7 @@ var PasskeyIntroView = require('./Passkey/PasskeyIntroView/PasskeyIntroView.cjs'
35
35
  var PasskeyBundleRecovery = require('./Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs');
36
36
  var PasskeyCompleteRecovery = require('./Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs');
37
37
  var PasskeyInitRecovery = require('./Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs');
38
+ var EmbeddedRevealView = require('./EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs');
38
39
 
39
40
  const viewToComponentMap = {
40
41
  'account-exists': jsxRuntime.jsx(AccountExistsView.AccountExistsView, {}),
@@ -46,6 +47,7 @@ const viewToComponentMap = {
46
47
  'collect-user-data': jsxRuntime.jsx(CollectUserDataView.CollectUserDataView, {}),
47
48
  'collect-user-data-login-with-email': jsxRuntime.jsx(CollectUserDataViewLoginWithEmail.CollectUserDataViewLoginWithEmail, {}),
48
49
  'email-wallet-otp-verification-view': jsxRuntime.jsx(EmailWalletOTPVerificationView.EmailWalletOTPVerificationView, {}),
50
+ 'embedded-reveal-view': jsxRuntime.jsx(EmbeddedRevealView.EmbeddedRevealView, {}),
49
51
  'gate-blocked-wallet': jsxRuntime.jsx(NoAccess.NoAccess, {}),
50
52
  'login-with-email-or-wallet': jsxRuntime.jsx(LoginView.LoginView, {}),
51
53
  'login-with-email-or-wallet-full-wallet-list': jsxRuntime.jsx(LoginView.LoginView, {}),
@@ -31,6 +31,7 @@ import { PasskeyIntroView } from './Passkey/PasskeyIntroView/PasskeyIntroView.js
31
31
  import { PasskeyBundleRecovery } from './Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js';
32
32
  import { PasskeyCompleteRecovery } from './Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js';
33
33
  import { PasskeyInitRecovery } from './Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js';
34
+ import { EmbeddedRevealView } from './EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js';
34
35
 
35
36
  const viewToComponentMap = {
36
37
  'account-exists': jsx(AccountExistsView, {}),
@@ -42,6 +43,7 @@ const viewToComponentMap = {
42
43
  'collect-user-data': jsx(CollectUserDataView, {}),
43
44
  'collect-user-data-login-with-email': jsx(CollectUserDataViewLoginWithEmail, {}),
44
45
  'email-wallet-otp-verification-view': jsx(EmailWalletOTPVerificationView, {}),
46
+ 'embedded-reveal-view': jsx(EmbeddedRevealView, {}),
45
47
  'gate-blocked-wallet': jsx(NoAccess, {}),
46
48
  'login-with-email-or-wallet': jsx(LoginView, {}),
47
49
  'login-with-email-or-wallet-full-wallet-list': jsx(LoginView, {}),
@@ -101,10 +101,10 @@ const ActiveWalletInformation = () => {
101
101
  },
102
102
  {
103
103
  Icon: null,
104
- callback: () => setDynamicWidgetView('manage-passkeys'),
104
+ callback: () => setDynamicWidgetView('wallet-settings'),
105
105
  hide: !(wallet &&
106
106
  walletConnectorCore.normalizeWalletName(wallet.connector.name).startsWith('turnkey')),
107
- text: 'My passkeys',
107
+ text: 'Wallet settings',
108
108
  },
109
109
  {
110
110
  Icon: null,
@@ -97,10 +97,10 @@ const ActiveWalletInformation = () => {
97
97
  },
98
98
  {
99
99
  Icon: null,
100
- callback: () => setDynamicWidgetView('manage-passkeys'),
100
+ callback: () => setDynamicWidgetView('wallet-settings'),
101
101
  hide: !(wallet &&
102
102
  normalizeWalletName(wallet.connector.name).startsWith('turnkey')),
103
- text: 'My passkeys',
103
+ text: 'Wallet settings',
104
104
  },
105
105
  {
106
106
  Icon: null,
@@ -9,12 +9,14 @@ var ProfileView = require('../../views/ProfileView/ProfileView.cjs');
9
9
  var EditProfileView = require('../../views/EditProfileView/EditProfileView.cjs');
10
10
  var SendBalanceWidgetView = require('../../views/SendBalanceWidgetView/SendBalanceWidgetView.cjs');
11
11
  var ManagePasskeysWidgetView = require('../../views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs');
12
+ var WalletSettingsView = require('../../views/WalletSettingsView/WalletSettingsView.cjs');
12
13
 
13
14
  const mapViewToComponent = {
14
15
  'edit-profile': EditProfileView.EditProfileView,
15
16
  'manage-passkeys': ManagePasskeysWidgetView.ManagePasskeysWidgetView,
16
17
  profile: ProfileView.ProfileView,
17
18
  'send-balance': SendBalanceWidgetView.SendBalanceWidgetView,
19
+ 'wallet-settings': WalletSettingsView.WalletSettingsView,
18
20
  wallets: WalletsView.WalletsView,
19
21
  };
20
22
  const DynamicWidgetViews = () => {
@@ -5,12 +5,14 @@ import { ProfileView } from '../../views/ProfileView/ProfileView.js';
5
5
  import { EditProfileView } from '../../views/EditProfileView/EditProfileView.js';
6
6
  import { SendBalanceWidgetView } from '../../views/SendBalanceWidgetView/SendBalanceWidgetView.js';
7
7
  import { ManagePasskeysWidgetView } from '../../views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js';
8
+ import { WalletSettingsView } from '../../views/WalletSettingsView/WalletSettingsView.js';
8
9
 
9
10
  const mapViewToComponent = {
10
11
  'edit-profile': EditProfileView,
11
12
  'manage-passkeys': ManagePasskeysWidgetView,
12
13
  profile: ProfileView,
13
14
  'send-balance': SendBalanceWidgetView,
15
+ 'wallet-settings': WalletSettingsView,
14
16
  wallets: WalletsView,
15
17
  };
16
18
  const DynamicWidgetViews = () => {
@@ -2,8 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const DynamicWalletSettingsViews = ['wallet-settings'];
5
6
  const DynamicPasskeyWidgetViews = ['manage-passkeys'];
6
7
  const DynamicTransactionsWidgetViews = ['send-balance'];
7
8
 
8
9
  exports.DynamicPasskeyWidgetViews = DynamicPasskeyWidgetViews;
9
10
  exports.DynamicTransactionsWidgetViews = DynamicTransactionsWidgetViews;
11
+ exports.DynamicWalletSettingsViews = DynamicWalletSettingsViews;
@@ -10,8 +10,10 @@ export interface WidgetContextProps {
10
10
  setIsOpen: Dispatch<SetStateAction<boolean>>;
11
11
  widgetRef: RefObject<HTMLDivElement>;
12
12
  }
13
+ export declare const DynamicWalletSettingsViews: readonly ["wallet-settings"];
14
+ export type DynamicWalletSettingsType = typeof DynamicWalletSettingsViews[number];
13
15
  export declare const DynamicPasskeyWidgetViews: readonly ["manage-passkeys"];
14
16
  export type DynamicPasskeyWidgetViewsType = typeof DynamicPasskeyWidgetViews[number];
15
17
  export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
16
18
  export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
17
- export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType;
19
+ export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicWalletSettingsType;
@@ -1,4 +1,5 @@
1
+ const DynamicWalletSettingsViews = ['wallet-settings'];
1
2
  const DynamicPasskeyWidgetViews = ['manage-passkeys'];
2
3
  const DynamicTransactionsWidgetViews = ['send-balance'];
3
4
 
4
- export { DynamicPasskeyWidgetViews, DynamicTransactionsWidgetViews };
5
+ export { DynamicPasskeyWidgetViews, DynamicTransactionsWidgetViews, DynamicWalletSettingsViews };
@@ -16,6 +16,7 @@ require('../../../../context/ViewContext/ViewContext.cjs');
16
16
  require('@dynamic-labs/sdk-api');
17
17
  require('../../../../shared/logger.cjs');
18
18
  require('@dynamic-labs/iconic');
19
+ var add = require('../../../../shared/assets/add.cjs');
19
20
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
20
21
  require('@dynamic-labs/wallet-book');
21
22
  require('../../../../utils/constants/colors.cjs');
@@ -65,13 +66,12 @@ require('@dynamic-labs/viem-utils');
65
66
  var PasskeyCard = require('./PasskeyCard/PasskeyCard.cjs');
66
67
  require('../../../../components/InlineWidget/InlineWidget.cjs');
67
68
  require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
68
- var NeedHelpSection = require('../../../../components/NeedHelpSection/NeedHelpSection.cjs');
69
69
  require('../../../../components/Popper/Popper/Popper.cjs');
70
70
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
71
71
  require('react-focus-lock');
72
72
 
73
73
  const ManagePasskeysWidgetView = () => {
74
- const { goToInitialDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
74
+ const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
75
75
  const { environmentId, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
76
76
  const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
77
77
  const { t } = reactI18next.useTranslation();
@@ -90,8 +90,8 @@ const ManagePasskeysWidgetView = () => {
90
90
  enabled: Boolean(environmentId) && Boolean(userJwt),
91
91
  });
92
92
  const isRecoveryEnabled = Boolean(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.passkeyEmbeddedWalletRecoveryEnabled);
93
- const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
94
- return (jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys.title', children: t('dyn_manage_passkeys.title') }) }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsxRuntime.jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsxRuntime.jsx(PasskeyCard.PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsxRuntime.jsx(Button.Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, showInternalLoading: false, copykey: 'dyn_manage_passkeys.recovery_button', children: t('dyn_manage_passkeys.recovery_button') })), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {})] })] }));
93
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => setDynamicWidgetView('wallet-settings'), "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
94
+ return (jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys.title', children: t('dyn_manage_passkeys.title') }) }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsxRuntime.jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsxRuntime.jsx(PasskeyCard.PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsxRuntime.jsx(Button.Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, showInternalLoading: false, startSlot: jsxRuntime.jsx(add.ReactComponent, {}), copykey: 'dyn_manage_passkeys.recovery_button', children: t('dyn_manage_passkeys.recovery_button') }))] })] }));
95
95
  };
96
96
 
97
97
  exports.ManagePasskeysWidgetView = ManagePasskeysWidgetView;
@@ -12,6 +12,7 @@ import '../../../../context/ViewContext/ViewContext.js';
12
12
  import '@dynamic-labs/sdk-api';
13
13
  import '../../../../shared/logger.js';
14
14
  import '@dynamic-labs/iconic';
15
+ import { ReactComponent as SvgAdd } from '../../../../shared/assets/add.js';
15
16
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
16
17
  import '@dynamic-labs/wallet-book';
17
18
  import '../../../../utils/constants/colors.js';
@@ -61,13 +62,12 @@ import '@dynamic-labs/viem-utils';
61
62
  import { PasskeyCard } from './PasskeyCard/PasskeyCard.js';
62
63
  import '../../../../components/InlineWidget/InlineWidget.js';
63
64
  import '../../../../components/MenuList/Dropdown/Dropdown.js';
64
- import { NeedHelpSection } from '../../../../components/NeedHelpSection/NeedHelpSection.js';
65
65
  import '../../../../components/Popper/Popper/Popper.js';
66
66
  import '../../../../components/Popper/PopperContext/PopperContext.js';
67
67
  import 'react-focus-lock';
68
68
 
69
69
  const ManagePasskeysWidgetView = () => {
70
- const { goToInitialDynamicWidgetView } = useWidgetContext();
70
+ const { setDynamicWidgetView } = useWidgetContext();
71
71
  const { environmentId, projectSettings } = useInternalDynamicContext();
72
72
  const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
73
73
  const { t } = useTranslation();
@@ -86,8 +86,8 @@ const ManagePasskeysWidgetView = () => {
86
86
  enabled: Boolean(environmentId) && Boolean(userJwt),
87
87
  });
88
88
  const isRecoveryEnabled = Boolean(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.passkeyEmbeddedWalletRecoveryEnabled);
89
- const backButton = (jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
90
- return (jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys.title', children: t('dyn_manage_passkeys.title') }) }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsx(Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsx(PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsx(Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, showInternalLoading: false, copykey: 'dyn_manage_passkeys.recovery_button', children: t('dyn_manage_passkeys.recovery_button') })), jsx(NeedHelpSection, {})] })] }));
89
+ const backButton = (jsx(IconButton, { type: 'button', onClick: () => setDynamicWidgetView('wallet-settings'), "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
90
+ return (jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys.title', children: t('dyn_manage_passkeys.title') }) }) }), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsx(Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsx(PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsx(Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, showInternalLoading: false, startSlot: jsx(SvgAdd, {}), copykey: 'dyn_manage_passkeys.recovery_button', children: t('dyn_manage_passkeys.recovery_button') }))] })] }));
91
91
  };
92
92
 
93
93
  export { ManagePasskeysWidgetView };
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var reactI18next = require('react-i18next');
7
+ require('react');
8
+ require('../../../../events/dynamicEvents.cjs');
9
+ require('@dynamic-labs/utils');
10
+ var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
11
+ require('@dynamic-labs/wallet-connector-core');
12
+ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
13
+ require('../../../../context/ErrorContext/ErrorContext.cjs');
14
+ require('../../../../context/ViewContext/ViewContext.cjs');
15
+ var decodeJwt = require('../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
16
+ require('@dynamic-labs/iconic');
17
+ var checkCircle = require('../../../../shared/assets/check-circle.cjs');
18
+ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
19
+ var lock = require('../../../../shared/assets/lock.cjs');
20
+ var altEmbeddedWallet = require('../../../../shared/assets/alt-embedded-wallet.cjs');
21
+ var faceId = require('../../../../shared/assets/face-id.cjs');
22
+ require('../../../../shared/logger.cjs');
23
+ require('@dynamic-labs/wallet-book');
24
+ require('../../../../utils/constants/colors.cjs');
25
+ require('../../../../shared/utils/classes/storage/localStorage.cjs');
26
+ require('viem');
27
+ require('../../../../shared/consts/index.cjs');
28
+ require('@dynamic-labs/multi-wallet');
29
+ require('@dynamic-labs/sdk-api');
30
+ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
31
+ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
32
+ require('../../../../config/ApiEndpoint.cjs');
33
+ require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
34
+ require('react-dom');
35
+ require('../../../../context/ThemeContext/ThemeContext.cjs');
36
+ require('@dynamic-labs/types');
37
+ require('yup');
38
+ require('../../../../context/MockContext/MockContext.cjs');
39
+ require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
40
+ require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
41
+ require('@dynamic-labs/rpc-providers');
42
+ require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
43
+ require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
44
+ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
45
+ require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
46
+ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
47
+ require('../../../../components/OverlayCard/OverlayCard.context.cjs');
48
+ require('../../../../context/FooterAnimationContext/index.cjs');
49
+ require('../../../../context/QrCodeContext/QrCodeContext.cjs');
50
+ var useIsTurnkeyWallet = require('../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
51
+ var Typography = require('../../../../components/Typography/Typography.cjs');
52
+ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
53
+ require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
54
+ require('qrcode');
55
+ require('../../../../context/LoadingContext/LoadingContext.cjs');
56
+ require('i18next');
57
+ var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
58
+ require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
59
+ require('formik');
60
+ var Button = require('../../../../components/Button/Button.cjs');
61
+ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
62
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
63
+ require('../../../../components/Alert/Alert.cjs');
64
+ require('@dynamic-labs/viem-utils');
65
+ require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
66
+ var useEmbeddedReveal = require('../../../../utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs');
67
+ require('../../../../components/InlineWidget/InlineWidget.cjs');
68
+ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
69
+ require('../../../../components/Popper/Popper/Popper.cjs');
70
+ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
71
+ require('react-focus-lock');
72
+
73
+ const WalletSettingsView = () => {
74
+ var _a, _b;
75
+ const { goToInitialDynamicWidgetView, setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
76
+ const { authToken } = useInternalDynamicContext.useInternalDynamicContext();
77
+ const { initExportProcess } = useEmbeddedReveal.useEmbeddedReveal();
78
+ const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
79
+ const { t } = reactI18next.useTranslation();
80
+ const decodedJwt = decodeJwt.decodeJwt(authToken);
81
+ const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
82
+ const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
83
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
84
+ return (jsxRuntime.jsxs("div", { className: 'wallet-settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'wallet-settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', children: t('dyn_wallet_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
85
+ // eslint-disable-next-line react/jsx-wrap-multilines
86
+ jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(faceId.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsxRuntime.jsx(Button.Button, { dataTestId: 'embedded-reveal-button', onClick: initExportProcess, buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
87
+ // eslint-disable-next-line react/jsx-wrap-multilines
88
+ jsxRuntime.jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(altEmbeddedWallet.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', children: isTurnkeyHDWallet
89
+ ? t('dyn_wallet_settings.export_section.srp_button')
90
+ : t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsxRuntime.jsx(lock.ReactComponent, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false })] })] })] }));
91
+ };
92
+
93
+ exports.WalletSettingsView = WalletSettingsView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const WalletSettingsView: FC;
@@ -0,0 +1,89 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useTranslation } from 'react-i18next';
3
+ import 'react';
4
+ import '../../../../events/dynamicEvents.js';
5
+ import '@dynamic-labs/utils';
6
+ import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
7
+ import '@dynamic-labs/wallet-connector-core';
8
+ import '../../../../context/CaptchaContext/CaptchaContext.js';
9
+ import '../../../../context/ErrorContext/ErrorContext.js';
10
+ import '../../../../context/ViewContext/ViewContext.js';
11
+ import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
12
+ import '@dynamic-labs/iconic';
13
+ import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
14
+ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
15
+ import { ReactComponent as SvgLock } from '../../../../shared/assets/lock.js';
16
+ import { ReactComponent as SvgAltEmbeddedWallet } from '../../../../shared/assets/alt-embedded-wallet.js';
17
+ import { ReactComponent as SvgFaceId } from '../../../../shared/assets/face-id.js';
18
+ import '../../../../shared/logger.js';
19
+ import '@dynamic-labs/wallet-book';
20
+ import '../../../../utils/constants/colors.js';
21
+ import '../../../../shared/utils/classes/storage/localStorage.js';
22
+ import 'viem';
23
+ import '../../../../shared/consts/index.js';
24
+ import '@dynamic-labs/multi-wallet';
25
+ import '@dynamic-labs/sdk-api';
26
+ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
27
+ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
28
+ import '../../../../config/ApiEndpoint.js';
29
+ import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
30
+ import 'react-dom';
31
+ import '../../../../context/ThemeContext/ThemeContext.js';
32
+ import '@dynamic-labs/types';
33
+ import 'yup';
34
+ import '../../../../context/MockContext/MockContext.js';
35
+ import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
36
+ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
37
+ import '@dynamic-labs/rpc-providers';
38
+ import '../../../../context/UserWalletsContext/UserWalletsContext.js';
39
+ import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
40
+ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
41
+ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
42
+ import '../../../../components/ShadowDOM/ShadowDOM.js';
43
+ import '../../../../components/OverlayCard/OverlayCard.context.js';
44
+ import '../../../../context/FooterAnimationContext/index.js';
45
+ import '../../../../context/QrCodeContext/QrCodeContext.js';
46
+ import { useIsTurnkeyWallet } from '../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
47
+ import { Typography } from '../../../../components/Typography/Typography.js';
48
+ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
49
+ import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
50
+ import 'qrcode';
51
+ import '../../../../context/LoadingContext/LoadingContext.js';
52
+ import 'i18next';
53
+ import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
54
+ import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
55
+ import 'formik';
56
+ import { Button } from '../../../../components/Button/Button.js';
57
+ import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
58
+ import { IconButton } from '../../../../components/IconButton/IconButton.js';
59
+ import '../../../../components/Alert/Alert.js';
60
+ import '@dynamic-labs/viem-utils';
61
+ import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
62
+ import { useEmbeddedReveal } from '../../../../utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js';
63
+ import '../../../../components/InlineWidget/InlineWidget.js';
64
+ import '../../../../components/MenuList/Dropdown/Dropdown.js';
65
+ import '../../../../components/Popper/Popper/Popper.js';
66
+ import '../../../../components/Popper/PopperContext/PopperContext.js';
67
+ import 'react-focus-lock';
68
+
69
+ const WalletSettingsView = () => {
70
+ var _a, _b;
71
+ const { goToInitialDynamicWidgetView, setDynamicWidgetView } = useWidgetContext();
72
+ const { authToken } = useInternalDynamicContext();
73
+ const { initExportProcess } = useEmbeddedReveal();
74
+ const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
75
+ const { t } = useTranslation();
76
+ const decodedJwt = decodeJwt(authToken);
77
+ const walletProperties = (_b = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
78
+ const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
79
+ const backButton = (jsx(IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
80
+ return (jsxs("div", { className: 'wallet-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'wallet-settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', children: t('dyn_wallet_settings.title') }) }) }), jsxs("div", { className: 'wallet-settings-view__body', children: [jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.signing_section.title') }), jsx(Button, { dataTestId: 'manage-passkeys-button', onClick: () => setDynamicWidgetView('manage-passkeys'), buttonClassName: 'wallet-settings-view__body__section__button', startSlot:
81
+ // eslint-disable-next-line react/jsx-wrap-multilines
82
+ jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'wallet-settings-view__body__section__button__icon' }), jsx(Typography, { weight: 'medium', children: t('dyn_wallet_settings.signing_section.passkey_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgCheckCircle, { className: 'wallet-settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false })] }), jsxs("div", { className: 'wallet-settings-view__body__section', children: [jsx("div", { className: 'wallet-settings-view__body__section__title', children: t('dyn_wallet_settings.export_section.title') }), jsx(Button, { dataTestId: 'embedded-reveal-button', onClick: initExportProcess, buttonClassName: 'wallet-settings-view__body__section__button', disabled: !isTurnkeyWallet || isTurnkeyWalletWithoutAuthenticator, startSlot:
83
+ // eslint-disable-next-line react/jsx-wrap-multilines
84
+ jsxs("div", { className: 'wallet-settings-view__body__section__button__start-slot', children: [jsx(SvgAltEmbeddedWallet, { className: 'wallet-settings-view__body__section__button__icon' }), jsx(Typography, { weight: 'medium', children: isTurnkeyHDWallet
85
+ ? t('dyn_wallet_settings.export_section.srp_button')
86
+ : t('dyn_wallet_settings.export_section.private_key_button') })] }), endSlot: isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator ? (jsx(SvgChevronLeft, { className: 'wallet-settings-view__body__section__button__icon-secondary--rotate' })) : (jsx(SvgLock, { className: 'wallet-settings-view__body__section__button__icon-secondary' })), showInternalLoading: false })] })] })] }));
87
+ };
88
+
89
+ export { WalletSettingsView };
@@ -0,0 +1 @@
1
+ export { WalletSettingsView } from './WalletSettingsView';
@@ -3,3 +3,4 @@ export { ProfileView } from './ProfileView/ProfileView';
3
3
  export { EditProfileView } from './EditProfileView/EditProfileView';
4
4
  export { SendBalanceWidgetView } from './SendBalanceWidgetView';
5
5
  export { ManagePasskeysWidgetView } from './ManagePasskeysWidgetView';
6
+ export { WalletSettingsView } from './WalletSettingsView';