@dynamic-labs/sdk-react-core 2.1.2-alpha.1 → 2.1.3

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 (82) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +13 -13
  5. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +1 -1
  6. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +1 -1
  7. package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +3 -0
  8. package/src/lib/components/PhoneNumberField/PhoneNumberField.js +3 -0
  9. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.cjs +10 -19
  10. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.d.ts +3 -2
  11. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.js +12 -21
  12. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/index.d.ts +1 -0
  13. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.cjs +57 -0
  14. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.d.ts +8 -0
  15. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.js +53 -0
  16. package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +13 -5
  17. package/src/lib/components/SignMessagePreview/SignMessagePreview.js +13 -5
  18. package/src/lib/components/SignMessagePreview/SignMessagePreview.types.d.ts +3 -0
  19. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.cjs +12 -0
  20. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.d.ts +1 -0
  21. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.js +8 -0
  22. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/index.d.ts +1 -0
  23. package/src/lib/components/SignMessagePreview/utils/index.d.ts +1 -0
  24. package/src/lib/components/SignMessagePreview/utils/isRawMessage/index.d.ts +1 -0
  25. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.cjs +13 -0
  26. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.d.ts +2 -0
  27. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.js +9 -0
  28. package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -4
  29. package/src/lib/context/DynamicContext/DynamicContext.d.ts +5 -0
  30. package/src/lib/context/DynamicContext/DynamicContext.js +6 -4
  31. package/src/lib/context/DynamicContext/types/index.d.ts +2 -0
  32. package/src/lib/shared/types/wallets.d.ts +1 -0
  33. package/src/lib/styles/index.shadow.cjs +1 -1
  34. package/src/lib/styles/index.shadow.js +1 -1
  35. package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.cjs +1 -0
  36. package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.js +1 -0
  37. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +0 -1
  38. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +0 -1
  39. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.cjs +24 -0
  40. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.d.ts +6 -0
  41. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.js +20 -0
  42. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/index.d.ts +1 -0
  43. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.cjs +2 -2
  44. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.d.ts +2 -2
  45. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.js +2 -2
  46. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.cjs +20 -0
  47. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.d.ts +9 -0
  48. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.js +16 -0
  49. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/index.d.ts +1 -0
  50. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/index.d.ts +1 -0
  51. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.cjs +30 -0
  52. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.d.ts +6 -0
  53. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.js +26 -0
  54. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +6 -5
  55. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +2 -2
  56. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +6 -5
  57. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -0
  58. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -0
  59. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -0
  60. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -0
  61. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +7 -3
  62. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +7 -3
  63. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +5 -1
  64. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +5 -1
  65. package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.cjs +14 -8
  66. package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.js +14 -8
  67. package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -1
  68. package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +1 -1
  69. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +2 -0
  70. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +2 -0
  71. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +4 -1
  72. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +4 -1
  73. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
  74. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
  75. package/src/lib/views/EmailVerification/EmailVerification.cjs +35 -42
  76. package/src/lib/views/EmailVerification/EmailVerification.js +35 -42
  77. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +4 -3
  78. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +4 -3
  79. package/src/lib/views/WalletList/WalletList.cjs +4 -3
  80. package/src/lib/views/WalletList/WalletList.js +4 -3
  81. package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.cjs +9 -2
  82. package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.js +9 -2
@@ -37,6 +37,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
37
37
  return user.verifiedCredentials
38
38
  .map(convertLegacyPhantomLedger)
39
39
  .map((account) => {
40
+ var _a;
40
41
  const wallet = findWallet.findWallet(account, walletConnectorOptions);
41
42
  // this probably shouldn't happen. this would mean that the user has an account linked
42
43
  // with wallet W, but the customer has toggled off wallet W or the chain that
@@ -68,6 +69,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
68
69
  connected: false,
69
70
  connector: wallet.walletConnector,
70
71
  id: account.id,
72
+ key: (_a = account.walletName) !== null && _a !== void 0 ? _a : wallet.walletConnector.key,
71
73
  };
72
74
  }
73
75
  return null;
@@ -33,6 +33,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
33
33
  return user.verifiedCredentials
34
34
  .map(convertLegacyPhantomLedger)
35
35
  .map((account) => {
36
+ var _a;
36
37
  const wallet = findWallet(account, walletConnectorOptions);
37
38
  // this probably shouldn't happen. this would mean that the user has an account linked
38
39
  // with wallet W, but the customer has toggled off wallet W or the chain that
@@ -64,6 +65,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
64
65
  connected: false,
65
66
  connector: wallet.walletConnector,
66
67
  id: account.id,
68
+ key: (_a = account.walletName) !== null && _a !== void 0 ? _a : wallet.walletConnector.key,
67
69
  };
68
70
  }
69
71
  return null;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var values = require('../../../../constants/values.cjs');
7
7
 
8
8
  const findWallet = (account, walletOptions) => {
9
+ var _a;
9
10
  const walletKey = account.walletName;
10
11
  if (walletKey === 'turnkeyhd') {
11
12
  const chain = account.chain
@@ -14,7 +15,9 @@ const findWallet = (account, walletOptions) => {
14
15
  return walletOptions.find((wallet) => walletKey === wallet.key &&
15
16
  wallet.walletConnector.connectedChain === chain);
16
17
  }
17
- return walletOptions.find((wallet) => walletKey === wallet.key);
18
+ // if we cannot find the correct connector for the wallet, we default to the unknown
19
+ // this way the wallet will appear in user wallets, but will not be able to be interacted with
20
+ return ((_a = walletOptions.find((wallet) => walletKey === wallet.key)) !== null && _a !== void 0 ? _a : walletOptions.find((wallet) => wallet.key === 'unknown'));
18
21
  };
19
22
 
20
23
  exports.findWallet = findWallet;
@@ -2,6 +2,7 @@
2
2
  import { VerifiedCredentialNameToChainEnum } from '../../../../constants/values.js';
3
3
 
4
4
  const findWallet = (account, walletOptions) => {
5
+ var _a;
5
6
  const walletKey = account.walletName;
6
7
  if (walletKey === 'turnkeyhd') {
7
8
  const chain = account.chain
@@ -10,7 +11,9 @@ const findWallet = (account, walletOptions) => {
10
11
  return walletOptions.find((wallet) => walletKey === wallet.key &&
11
12
  wallet.walletConnector.connectedChain === chain);
12
13
  }
13
- return walletOptions.find((wallet) => walletKey === wallet.key);
14
+ // if we cannot find the correct connector for the wallet, we default to the unknown
15
+ // this way the wallet will appear in user wallets, but will not be able to be interacted with
16
+ return ((_a = walletOptions.find((wallet) => walletKey === wallet.key)) !== null && _a !== void 0 ? _a : walletOptions.find((wallet) => wallet.key === 'unknown'));
14
17
  };
15
18
 
16
19
  export { findWallet };
@@ -105,7 +105,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, hideEmbeddedWalle
105
105
  return false;
106
106
  }
107
107
  return true;
108
- }, [confirmationStateRef]);
108
+ }, [confirmationStateRef, hideEmbeddedWalletTransactionUIs]);
109
109
  const signMessage = React.useCallback(({ message, handler }) => {
110
110
  if (!shouldConfirmAction()) {
111
111
  return handler();
@@ -101,7 +101,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, hideEmbeddedWalle
101
101
  return false;
102
102
  }
103
103
  return true;
104
- }, [confirmationStateRef]);
104
+ }, [confirmationStateRef, hideEmbeddedWalletTransactionUIs]);
105
105
  const signMessage = useCallback(({ message, handler }) => {
106
106
  if (!shouldConfirmAction()) {
107
107
  return handler();
@@ -103,7 +103,7 @@ const SECONDS_TO_RETRY = 15;
103
103
  const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _showRetryButton = true, showTransferMessage: _showTransferMessage = false, }) => {
104
104
  var _a, _b, _c, _d;
105
105
  const { environmentId, handleLogOut, setPrimaryWalletId, setShowAuthFlow, projectSettings, user, unauthenticatedUser, } = useInternalDynamicContext.useInternalDynamicContext();
106
- const { view, setView, goToInitialView } = ViewContext.useViewContext();
106
+ const { setView, goToInitialView } = ViewContext.useViewContext();
107
107
  const { error, setError, setErrorMessage } = ErrorContext.useErrorContext();
108
108
  const { loading, setLoading } = LoadingContext.useLoadingContext();
109
109
  const [showRetryButton, setShowRetryButton] = React.useState(_showRetryButton);
@@ -135,10 +135,9 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
135
135
  if (!email$1)
136
136
  logger.logger.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined");
137
137
  });
138
- const isLoginView = view.type === 'login-with-email-verification';
139
138
  const { verifyOtp } = useOtpVerificationRequest.useOtpVerificationRequest();
140
139
  const completeSignInFlow = React.useCallback((updateUserProfileResponse) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
141
- var _e, _f, _g, _h, _j;
140
+ var _e, _f, _g, _h, _j, _k;
142
141
  if (updateUserProfileResponse.nextView === 'verified-and-transferred') {
143
142
  setShowTransferMessage === null || setShowTransferMessage === void 0 ? void 0 : setShowTransferMessage(true);
144
143
  }
@@ -149,9 +148,13 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
149
148
  });
150
149
  return true;
151
150
  }
151
+ if (!isTurnkeyWallet) {
152
+ return false;
153
+ }
152
154
  // If the user has a turnkey embedded wallet and no recovery email, add the email as a recovery email
153
- if (isTurnkeyWallet &&
154
- hasTurnkeyVerifiedCredentialAuthenticator &&
155
+ // This logic should run even if the turnkey provider is not enabled anymore
156
+ // (e.g. user created the wallet and then the settings were disalbed)
157
+ if (hasTurnkeyVerifiedCredentialAuthenticator &&
155
158
  !hasRecoveryEmail &&
156
159
  ((_e = updateUserProfileResponse === null || updateUserProfileResponse === void 0 ? void 0 : updateUserProfileResponse.user) === null || _e === void 0 ? void 0 : _e.email)) {
157
160
  storeAuthTokenAndUser.storeAuthTokenAndUser(updateUserProfileResponse);
@@ -159,9 +162,11 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
159
162
  setShowAuthFlow(false);
160
163
  return true;
161
164
  }
165
+ // The logic below is needed when we capture an email after a user
166
+ // authenticated with Sms/Twitter etc And we need to capture and email.
162
167
  if (isTurnkeyProviderEnabled) {
163
- const isManualMode = !((_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.embeddedWallets) === null || _g === void 0 ? void 0 : _g.automaticEmbeddedWalletCreation);
164
- const isUsingPregeneratedWallets = Boolean(!isManualMode &&
168
+ const isAutomaticWalletCreation = (_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.embeddedWallets) === null || _g === void 0 ? void 0 : _g.automaticEmbeddedWalletCreation;
169
+ const isUsingPregeneratedWallets = Boolean(isAutomaticWalletCreation &&
165
170
  !((_j = (_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _h === void 0 ? void 0 : _h.embeddedWallets) === null || _j === void 0 ? void 0 : _j.forceAuthenticatorAtSignup));
166
171
  if (isUsingPregeneratedWallets) {
167
172
  // Pregenerated wallet was created during an
@@ -181,11 +186,12 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
181
186
  // @ts-ignore
182
187
  connector: undefined,
183
188
  id: embeddedWalletVerifiedCredential.id,
189
+ key: (_k = embeddedWalletVerifiedCredential.walletName) !== null && _k !== void 0 ? _k : '',
184
190
  };
185
191
  setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
186
192
  dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, updateUserProfileResponse.jwt, user);
187
193
  }
188
- if (isUsingPregeneratedWallets || isManualMode) {
194
+ if (isUsingPregeneratedWallets || !isAutomaticWalletCreation) {
189
195
  setShowAuthFlow(false);
190
196
  return true;
191
197
  }
@@ -205,14 +211,25 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
205
211
  setView,
206
212
  user,
207
213
  ]);
208
- const handleComplete = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
214
+ const handleEmailVerification = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
209
215
  setError(undefined);
210
216
  setLoading(true);
211
- if (!verificationUUID || (!user && !unauthenticatedUser)) {
212
- yield cancelAuth();
213
- return;
217
+ if (!verificationUUID) {
218
+ return cancelAuth();
214
219
  }
215
- yield completeAuth({
220
+ if (!user && !unauthenticatedUser) {
221
+ return initAuth({
222
+ onVerifySuccess: () => setIsValidated(true),
223
+ options: { email: email$1 },
224
+ showSuccessMessage: true,
225
+ verifyFunction: () => email.signInWithEmailVerification({
226
+ environmentId,
227
+ verificationToken,
228
+ verificationUUID,
229
+ }),
230
+ });
231
+ }
232
+ return completeAuth({
216
233
  completeSignInFlow: (updateUserResponse) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return completeSignInFlow(updateUserResponse); }),
217
234
  onValidUpdatedJwt: () => {
218
235
  // This causes emaiLVerificationSuccess to be raised, so it should be set as soon
@@ -226,40 +243,16 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
226
243
  setError,
227
244
  setLoading,
228
245
  verificationUUID,
246
+ user,
247
+ unauthenticatedUser,
229
248
  completeAuth,
230
249
  email$1,
231
250
  isEmailRecoveryFlow,
232
251
  cancelAuth,
233
- completeSignInFlow,
234
- verifyOtp,
235
- user,
236
- unauthenticatedUser,
237
- ]);
238
- const handleEmailLogin = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
239
- setError(undefined);
240
- setLoading(true);
241
- if (!verificationUUID) {
242
- yield cancelAuth();
243
- return;
244
- }
245
- yield initAuth({
246
- onVerifySuccess: () => setIsValidated(true),
247
- options: { email: email$1 },
248
- showSuccessMessage: true,
249
- verifyFunction: () => email.signInWithEmailVerification({
250
- environmentId,
251
- verificationToken,
252
- verificationUUID,
253
- }),
254
- });
255
- }), [
256
- setError,
257
- setLoading,
258
- verificationUUID,
259
252
  initAuth,
260
- email$1,
261
- cancelAuth,
262
253
  environmentId,
254
+ completeSignInFlow,
255
+ verifyOtp,
263
256
  ]);
264
257
  const handleRetry = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
265
258
  try {
@@ -295,7 +288,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
295
288
  }, []);
296
289
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, className: 'email-verification__error-message', children: error })), jsxRuntime.jsxs("div", { className: classNames.classNames('email-verification__container', {
297
290
  'email-verification__container--error': Boolean(error),
298
- }), children: [showTransferMessage && (jsxRuntime.jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsxRuntime.jsx("div", { className: 'email-verification__icon-container', children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: check.ReactComponent }) })) : (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxRuntime.jsxs("div", { className: 'email-verification__copy-text-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail.shortenEmail(email$1) })] }), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsxRuntime.jsx(RetrySendVerificationCodeSection.RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), !isLoginView && !isEmailRecoveryFlow && (jsxRuntime.jsx(TextButton.TextButton, { className: 'email-verification__log-out', onClick: handleLogOut, copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
291
+ }), children: [showTransferMessage && (jsxRuntime.jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsxRuntime.jsx("div", { className: 'email-verification__icon-container', children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: check.ReactComponent }) })) : (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxRuntime.jsxs("div", { className: 'email-verification__copy-text-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail.shortenEmail(email$1) })] }), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsxRuntime.jsx(RetrySendVerificationCodeSection.RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || unauthenticatedUser) && !isEmailRecoveryFlow && (jsxRuntime.jsx(TextButton.TextButton, { className: 'email-verification__log-out', onClick: handleLogOut, copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
299
292
  };
300
293
 
301
294
  exports.EmailVerification = EmailVerification;
@@ -99,7 +99,7 @@ const SECONDS_TO_RETRY = 15;
99
99
  const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _showRetryButton = true, showTransferMessage: _showTransferMessage = false, }) => {
100
100
  var _a, _b, _c, _d;
101
101
  const { environmentId, handleLogOut, setPrimaryWalletId, setShowAuthFlow, projectSettings, user, unauthenticatedUser, } = useInternalDynamicContext();
102
- const { view, setView, goToInitialView } = useViewContext();
102
+ const { setView, goToInitialView } = useViewContext();
103
103
  const { error, setError, setErrorMessage } = useErrorContext();
104
104
  const { loading, setLoading } = useLoadingContext();
105
105
  const [showRetryButton, setShowRetryButton] = useState(_showRetryButton);
@@ -131,10 +131,9 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
131
131
  if (!email)
132
132
  logger.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined");
133
133
  });
134
- const isLoginView = view.type === 'login-with-email-verification';
135
134
  const { verifyOtp } = useOtpVerificationRequest();
136
135
  const completeSignInFlow = useCallback((updateUserProfileResponse) => __awaiter(void 0, void 0, void 0, function* () {
137
- var _e, _f, _g, _h, _j;
136
+ var _e, _f, _g, _h, _j, _k;
138
137
  if (updateUserProfileResponse.nextView === 'verified-and-transferred') {
139
138
  setShowTransferMessage === null || setShowTransferMessage === void 0 ? void 0 : setShowTransferMessage(true);
140
139
  }
@@ -145,9 +144,13 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
145
144
  });
146
145
  return true;
147
146
  }
147
+ if (!isTurnkeyWallet) {
148
+ return false;
149
+ }
148
150
  // If the user has a turnkey embedded wallet and no recovery email, add the email as a recovery email
149
- if (isTurnkeyWallet &&
150
- hasTurnkeyVerifiedCredentialAuthenticator &&
151
+ // This logic should run even if the turnkey provider is not enabled anymore
152
+ // (e.g. user created the wallet and then the settings were disalbed)
153
+ if (hasTurnkeyVerifiedCredentialAuthenticator &&
151
154
  !hasRecoveryEmail &&
152
155
  ((_e = updateUserProfileResponse === null || updateUserProfileResponse === void 0 ? void 0 : updateUserProfileResponse.user) === null || _e === void 0 ? void 0 : _e.email)) {
153
156
  storeAuthTokenAndUser(updateUserProfileResponse);
@@ -155,9 +158,11 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
155
158
  setShowAuthFlow(false);
156
159
  return true;
157
160
  }
161
+ // The logic below is needed when we capture an email after a user
162
+ // authenticated with Sms/Twitter etc And we need to capture and email.
158
163
  if (isTurnkeyProviderEnabled) {
159
- const isManualMode = !((_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.embeddedWallets) === null || _g === void 0 ? void 0 : _g.automaticEmbeddedWalletCreation);
160
- const isUsingPregeneratedWallets = Boolean(!isManualMode &&
164
+ const isAutomaticWalletCreation = (_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.embeddedWallets) === null || _g === void 0 ? void 0 : _g.automaticEmbeddedWalletCreation;
165
+ const isUsingPregeneratedWallets = Boolean(isAutomaticWalletCreation &&
161
166
  !((_j = (_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _h === void 0 ? void 0 : _h.embeddedWallets) === null || _j === void 0 ? void 0 : _j.forceAuthenticatorAtSignup));
162
167
  if (isUsingPregeneratedWallets) {
163
168
  // Pregenerated wallet was created during an
@@ -177,11 +182,12 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
177
182
  // @ts-ignore
178
183
  connector: undefined,
179
184
  id: embeddedWalletVerifiedCredential.id,
185
+ key: (_k = embeddedWalletVerifiedCredential.walletName) !== null && _k !== void 0 ? _k : '',
180
186
  };
181
187
  setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
182
188
  dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, updateUserProfileResponse.jwt, user);
183
189
  }
184
- if (isUsingPregeneratedWallets || isManualMode) {
190
+ if (isUsingPregeneratedWallets || !isAutomaticWalletCreation) {
185
191
  setShowAuthFlow(false);
186
192
  return true;
187
193
  }
@@ -201,14 +207,25 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
201
207
  setView,
202
208
  user,
203
209
  ]);
204
- const handleComplete = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
210
+ const handleEmailVerification = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
205
211
  setError(undefined);
206
212
  setLoading(true);
207
- if (!verificationUUID || (!user && !unauthenticatedUser)) {
208
- yield cancelAuth();
209
- return;
213
+ if (!verificationUUID) {
214
+ return cancelAuth();
210
215
  }
211
- yield completeAuth({
216
+ if (!user && !unauthenticatedUser) {
217
+ return initAuth({
218
+ onVerifySuccess: () => setIsValidated(true),
219
+ options: { email },
220
+ showSuccessMessage: true,
221
+ verifyFunction: () => signInWithEmailVerification({
222
+ environmentId,
223
+ verificationToken,
224
+ verificationUUID,
225
+ }),
226
+ });
227
+ }
228
+ return completeAuth({
212
229
  completeSignInFlow: (updateUserResponse) => __awaiter(void 0, void 0, void 0, function* () { return completeSignInFlow(updateUserResponse); }),
213
230
  onValidUpdatedJwt: () => {
214
231
  // This causes emaiLVerificationSuccess to be raised, so it should be set as soon
@@ -222,40 +239,16 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
222
239
  setError,
223
240
  setLoading,
224
241
  verificationUUID,
242
+ user,
243
+ unauthenticatedUser,
225
244
  completeAuth,
226
245
  email,
227
246
  isEmailRecoveryFlow,
228
247
  cancelAuth,
229
- completeSignInFlow,
230
- verifyOtp,
231
- user,
232
- unauthenticatedUser,
233
- ]);
234
- const handleEmailLogin = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
235
- setError(undefined);
236
- setLoading(true);
237
- if (!verificationUUID) {
238
- yield cancelAuth();
239
- return;
240
- }
241
- yield initAuth({
242
- onVerifySuccess: () => setIsValidated(true),
243
- options: { email },
244
- showSuccessMessage: true,
245
- verifyFunction: () => signInWithEmailVerification({
246
- environmentId,
247
- verificationToken,
248
- verificationUUID,
249
- }),
250
- });
251
- }), [
252
- setError,
253
- setLoading,
254
- verificationUUID,
255
248
  initAuth,
256
- email,
257
- cancelAuth,
258
249
  environmentId,
250
+ completeSignInFlow,
251
+ verifyOtp,
259
252
  ]);
260
253
  const handleRetry = () => __awaiter(void 0, void 0, void 0, function* () {
261
254
  try {
@@ -291,7 +284,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
291
284
  }, []);
292
285
  return (jsxs(Fragment, { children: [error && (jsx(ErrorContainer, { withIcon: false, className: 'email-verification__error-message', children: error })), jsxs("div", { className: classNames('email-verification__container', {
293
286
  'email-verification__container--error': Boolean(error),
294
- }), children: [showTransferMessage && (jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsx("div", { className: 'email-verification__icon-container', children: jsx(IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: SvgCheck }) })) : (jsx(IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxs("div", { className: 'email-verification__copy-text-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail(email) })] }), jsx(PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsx(RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), !isLoginView && !isEmailRecoveryFlow && (jsx(TextButton, { className: 'email-verification__log-out', onClick: handleLogOut, copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
287
+ }), children: [showTransferMessage && (jsx("div", { className: 'email-verification__transfer-message', copykey: 'dyn_otp_verification.email.complete', children: t('dyn_otp_verification.email.complete') })), isValidated ? (jsx("div", { className: 'email-verification__icon-container', children: jsx(IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: EmailIcon, iconSize: 64, InnerIcon: SvgCheck }) })) : (jsx(IconWithSpinner, { Icon: EmailIcon, iconSize: 96, isSpinning: true, className: 'email-verification__icon-with-spinner' })), jsxs("div", { className: 'email-verification__copy-text-container', children: [jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_otp_verification.description', children: t('dyn_otp_verification.description') }), jsx(Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', children: shortenEmail(email) })] }), jsx(PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: handleEmailVerification, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), showRetryButton && (jsx(RetrySendVerificationCodeSection, { className: 'email-verification__retry-container', retryHandler: handleRetry, secondsToRetry: SECONDS_TO_RETRY })), (user || unauthenticatedUser) && !isEmailRecoveryFlow && (jsx(TextButton, { className: 'email-verification__log-out', onClick: handleLogOut, copykey: 'dyn_otp_verification.log_out_button', children: t('dyn_otp_verification.log_out_button') }))] })] }));
295
288
  };
296
289
 
297
290
  export { EmailVerification };
@@ -33,7 +33,7 @@ require('@dynamic-labs/store');
33
33
  require('../../../../../locale/locale.cjs');
34
34
  require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
35
35
  require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
36
- require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
36
+ var UserWalletsContext = require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
37
37
  require('../../../../../context/VerificationContext/VerificationContext.cjs');
38
38
  require('react-dom');
39
39
  require('../../../../../context/WalletContext/WalletContext.cjs');
@@ -84,11 +84,11 @@ var useInternalDynamicContext = require('../../../../../context/DynamicContext/u
84
84
 
85
85
  const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
86
86
  const { t } = reactI18next.useTranslation();
87
- const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
87
+ const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
88
+ const userWallets = UserWalletsContext.useUserWallets();
88
89
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
89
90
  const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
90
91
  authMode,
91
- connectedWallets,
92
92
  groupWallets: true,
93
93
  inputList: walletConnectorOptions,
94
94
  isWalletConnectList: false,
@@ -99,6 +99,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
99
99
  recommendedWallets,
100
100
  searchFilter: undefined,
101
101
  signWithEmailWalletName,
102
+ userWallets,
102
103
  walletBook: walletBook$1,
103
104
  walletsFilter,
104
105
  });
@@ -29,7 +29,7 @@ import '@dynamic-labs/store';
29
29
  import '../../../../../locale/locale.js';
30
30
  import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
31
31
  import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
32
- import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
32
+ import { useUserWallets } from '../../../../../context/UserWalletsContext/UserWalletsContext.js';
33
33
  import '../../../../../context/VerificationContext/VerificationContext.js';
34
34
  import 'react-dom';
35
35
  import '../../../../../context/WalletContext/WalletContext.js';
@@ -80,11 +80,11 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
80
80
 
81
81
  const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
82
82
  const { t } = useTranslation();
83
- const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, recommendedWallets, } = useInternalDynamicContext();
83
+ const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
84
+ const userWallets = useUserWallets();
84
85
  const { walletBook } = useWalletBookContext();
85
86
  const { numberOfWallets, walletsList } = walletListBuilder({
86
87
  authMode,
87
- connectedWallets,
88
88
  groupWallets: true,
89
89
  inputList: walletConnectorOptions,
90
90
  isWalletConnectList: false,
@@ -95,6 +95,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
95
95
  recommendedWallets,
96
96
  searchFilter: undefined,
97
97
  signWithEmailWalletName,
98
+ userWallets,
98
99
  walletBook,
99
100
  walletsFilter,
100
101
  });
@@ -37,7 +37,7 @@ require('@dynamic-labs/store');
37
37
  require('../../locale/locale.cjs');
38
38
  require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
39
39
  require('../../context/AccountExistsContext/AccountExistsContext.cjs');
40
- require('../../context/UserWalletsContext/UserWalletsContext.cjs');
40
+ var UserWalletsContext = require('../../context/UserWalletsContext/UserWalletsContext.cjs');
41
41
  require('../../context/VerificationContext/VerificationContext.cjs');
42
42
  require('react-dom');
43
43
  require('../../context/WalletContext/WalletContext.cjs');
@@ -95,7 +95,8 @@ var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWal
95
95
  localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
96
96
  const WalletList = ({ isWalletConnectList = false, }) => {
97
97
  var _a;
98
- const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
98
+ const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
99
+ const userWallets = UserWalletsContext.useUserWallets();
99
100
  const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState.useTabState();
100
101
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
101
102
  const { error } = ErrorContext.useErrorContext();
@@ -109,7 +110,6 @@ const WalletList = ({ isWalletConnectList = false, }) => {
109
110
  const effectiveRecommendedWallets = getEffectiveRecommendedWallets.getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
110
111
  const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
111
112
  authMode,
112
- connectedWallets,
113
113
  groupWallets: true,
114
114
  inputList: filteredBridgeChains || walletConnectorOptions,
115
115
  isWalletConnectList,
@@ -120,6 +120,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
120
120
  searchFilter: filterValue,
121
121
  showMoreWalletsWithFilter: true,
122
122
  signWithEmailWalletName,
123
+ userWallets,
123
124
  walletBook: walletBook$1,
124
125
  walletsFilter: getEffectiveWalletFilter.getEffectiveWalletFilter(selectedTabSettings, walletsFilter),
125
126
  });
@@ -33,7 +33,7 @@ import '@dynamic-labs/store';
33
33
  import '../../locale/locale.js';
34
34
  import '../../context/AccessDeniedContext/AccessDeniedContext.js';
35
35
  import '../../context/AccountExistsContext/AccountExistsContext.js';
36
- import '../../context/UserWalletsContext/UserWalletsContext.js';
36
+ import { useUserWallets } from '../../context/UserWalletsContext/UserWalletsContext.js';
37
37
  import '../../context/VerificationContext/VerificationContext.js';
38
38
  import 'react-dom';
39
39
  import '../../context/WalletContext/WalletContext.js';
@@ -91,7 +91,8 @@ import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedW
91
91
  LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
92
92
  const WalletList = ({ isWalletConnectList = false, }) => {
93
93
  var _a;
94
- const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
94
+ const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
95
+ const userWallets = useUserWallets();
95
96
  const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState();
96
97
  const { walletBook } = useWalletBookContext();
97
98
  const { error } = useErrorContext();
@@ -105,7 +106,6 @@ const WalletList = ({ isWalletConnectList = false, }) => {
105
106
  const effectiveRecommendedWallets = getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
106
107
  const { numberOfWallets, walletsList } = walletListBuilder({
107
108
  authMode,
108
- connectedWallets,
109
109
  groupWallets: true,
110
110
  inputList: filteredBridgeChains || walletConnectorOptions,
111
111
  isWalletConnectList,
@@ -116,6 +116,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
116
116
  searchFilter: filterValue,
117
117
  showMoreWalletsWithFilter: true,
118
118
  signWithEmailWalletName,
119
+ userWallets,
119
120
  walletBook,
120
121
  walletsFilter: getEffectiveWalletFilter(selectedTabSettings, walletsFilter),
121
122
  });
@@ -22,12 +22,13 @@ require('@dynamic-labs/sdk-api-core');
22
22
  require('../../shared/logger.cjs');
23
23
  require('@dynamic-labs/iconic');
24
24
  require('@dynamic-labs/wallet-connector-core');
25
- require('../../context/ViewContext/ViewContext.cjs');
25
+ var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
26
26
  require('@dynamic-labs/wallet-book');
27
27
  require('../../utils/constants/colors.cjs');
28
28
  require('../../utils/constants/values.cjs');
29
29
  require('../../shared/utils/classes/storage/localStorage.cjs');
30
30
  require('../../shared/consts/index.cjs');
31
+ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
31
32
  require('../../context/CaptchaContext/CaptchaContext.cjs');
32
33
  require('../../context/ErrorContext/ErrorContext.cjs');
33
34
  require('@dynamic-labs/multi-wallet');
@@ -86,8 +87,12 @@ require('../DynamicWidget/context/DynamicWidgetContext.cjs');
86
87
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
87
88
  require('../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
88
89
 
90
+ const pendingSignModalView = ['pending-signature', 'wallet-sign'];
89
91
  const DynamicMultiWalletPromptsWidget = () => {
90
92
  const isLoggedIn = useIsLoggedIn.useIsLoggedIn();
93
+ const { showAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
94
+ const { view } = ViewContext.useViewContext();
95
+ const isRenderingSignMessageInLinkWalletModal = showAuthFlow && pendingSignModalView.includes(view.type);
91
96
  const multiWalletPromptState = useMultiWalletPromptState.useMultiWalletPromptState();
92
97
  const mapMultiWalletPromptStateToModalComponent = {
93
98
  awaiting_connection: AwaitingConnectionModal.AwaitingConnectionModal,
@@ -98,7 +103,9 @@ const DynamicMultiWalletPromptsWidget = () => {
98
103
  primary_not_connected: PrimaryNotConnectedModal.PrimaryNotConnectedModal,
99
104
  unlink_wallet: UnlinkWalletPopUp.UnlinkWalletPopUpModal,
100
105
  };
101
- if (multiWalletPromptState === 'idle' || !isLoggedIn)
106
+ if (multiWalletPromptState === 'idle' ||
107
+ isRenderingSignMessageInLinkWalletModal ||
108
+ !isLoggedIn)
102
109
  return null;
103
110
  const ModalComponent = mapMultiWalletPromptStateToModalComponent[multiWalletPromptState];
104
111
  return (jsxRuntime.jsx(DynamicBaseWidget.DynamicBaseWidget, { children: jsxRuntime.jsx(ModalComponent, {}) }));
@@ -18,12 +18,13 @@ import '@dynamic-labs/sdk-api-core';
18
18
  import '../../shared/logger.js';
19
19
  import '@dynamic-labs/iconic';
20
20
  import '@dynamic-labs/wallet-connector-core';
21
- import '../../context/ViewContext/ViewContext.js';
21
+ import { useViewContext } from '../../context/ViewContext/ViewContext.js';
22
22
  import '@dynamic-labs/wallet-book';
23
23
  import '../../utils/constants/colors.js';
24
24
  import '../../utils/constants/values.js';
25
25
  import '../../shared/utils/classes/storage/localStorage.js';
26
26
  import '../../shared/consts/index.js';
27
+ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
27
28
  import '../../context/CaptchaContext/CaptchaContext.js';
28
29
  import '../../context/ErrorContext/ErrorContext.js';
29
30
  import '@dynamic-labs/multi-wallet';
@@ -82,8 +83,12 @@ import '../DynamicWidget/context/DynamicWidgetContext.js';
82
83
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
83
84
  import '../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
84
85
 
86
+ const pendingSignModalView = ['pending-signature', 'wallet-sign'];
85
87
  const DynamicMultiWalletPromptsWidget = () => {
86
88
  const isLoggedIn = useIsLoggedIn();
89
+ const { showAuthFlow } = useInternalDynamicContext();
90
+ const { view } = useViewContext();
91
+ const isRenderingSignMessageInLinkWalletModal = showAuthFlow && pendingSignModalView.includes(view.type);
87
92
  const multiWalletPromptState = useMultiWalletPromptState();
88
93
  const mapMultiWalletPromptStateToModalComponent = {
89
94
  awaiting_connection: AwaitingConnectionModal,
@@ -94,7 +99,9 @@ const DynamicMultiWalletPromptsWidget = () => {
94
99
  primary_not_connected: PrimaryNotConnectedModal,
95
100
  unlink_wallet: UnlinkWalletPopUpModal,
96
101
  };
97
- if (multiWalletPromptState === 'idle' || !isLoggedIn)
102
+ if (multiWalletPromptState === 'idle' ||
103
+ isRenderingSignMessageInLinkWalletModal ||
104
+ !isLoggedIn)
98
105
  return null;
99
106
  const ModalComponent = mapMultiWalletPromptStateToModalComponent[multiWalletPromptState];
100
107
  return (jsx(DynamicBaseWidget, { children: jsx(ModalComponent, {}) }));