@dynamic-labs/sdk-react-core 4.20.5 → 4.20.7

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 (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +8 -3
  6. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +8 -3
  7. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  8. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +2 -0
  9. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +2 -0
  10. package/src/lib/locale/en/translation.cjs +20 -0
  11. package/src/lib/locale/en/translation.d.ts +20 -0
  12. package/src/lib/locale/en/translation.js +20 -0
  13. package/src/lib/shared/assets/index.d.ts +2 -0
  14. package/src/lib/shared/assets/locked.cjs +52 -0
  15. package/src/lib/shared/assets/locked.js +28 -0
  16. package/src/lib/shared/assets/white-check-black-circle.cjs +61 -0
  17. package/src/lib/shared/assets/white-check-black-circle.js +37 -0
  18. package/src/lib/styles/index.shadow.cjs +1 -1
  19. package/src/lib/styles/index.shadow.js +1 -1
  20. package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
  21. package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
  22. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +3 -0
  23. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +1 -1
  24. package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +3 -0
  25. package/src/lib/utils/hooks/index.d.ts +1 -0
  26. package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +1 -1
  27. package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +1 -1
  28. package/src/lib/utils/hooks/useDynamicWaas/constants.js +1 -1
  29. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +34 -28
  30. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +34 -28
  31. package/src/lib/utils/hooks/useSubmitExchangeFunding/index.d.ts +1 -0
  32. package/src/lib/utils/hooks/useSubmitExchangeFunding/useSubmitExchangeFunding.d.ts +11 -0
  33. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +14 -4
  34. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +14 -4
  35. package/src/lib/views/MfaExchangeView/MfaExchangeView.cjs +127 -0
  36. package/src/lib/views/MfaExchangeView/MfaExchangeView.d.ts +7 -0
  37. package/src/lib/views/MfaExchangeView/MfaExchangeView.js +123 -0
  38. package/src/lib/views/MfaExchangeView/index.d.ts +1 -0
  39. package/src/lib/views/viewToComponentMap.cjs +2 -0
  40. package/src/lib/views/viewToComponentMap.d.ts +4 -0
  41. package/src/lib/views/viewToComponentMap.js +2 -0
  42. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -0
  43. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +8 -13
  44. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -0
  45. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
  46. package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.d.ts +1 -2
  47. package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.cjs +121 -0
  48. package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.d.ts +11 -0
  49. package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.js +117 -0
  50. package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/index.d.ts +1 -0
@@ -42,6 +42,7 @@ const viewsThatHideHeader = [
42
42
  'passkey-recovery-start',
43
43
  'embedded-reveal-view',
44
44
  'embedded-reveal-account-view',
45
+ 'mfa-exchange-view',
45
46
  'rename-passkey',
46
47
  'embedded-wallet-auth-choice',
47
48
  'passkey-recovery-add-email',
@@ -38,6 +38,7 @@ const viewsThatHideHeader = [
38
38
  'passkey-recovery-start',
39
39
  'embedded-reveal-view',
40
40
  'embedded-reveal-account-view',
41
+ 'mfa-exchange-view',
41
42
  'rename-passkey',
42
43
  'embedded-wallet-auth-choice',
43
44
  'passkey-recovery-add-email',
@@ -7,6 +7,9 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
 
8
8
  const getTransactionLink = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, transactionHash, }) {
9
9
  try {
10
+ if (!walletConnector) {
11
+ return undefined;
12
+ }
10
13
  const [blockExplorerUrl] = yield walletConnector.getBlockExplorerUrlsForCurrentNetwork();
11
14
  if (!blockExplorerUrl)
12
15
  return undefined;
@@ -1,5 +1,5 @@
1
1
  import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
2
  export declare const getTransactionLink: ({ walletConnector, transactionHash, }: {
3
- walletConnector: WalletConnector;
3
+ walletConnector?: WalletConnector;
4
4
  transactionHash: string;
5
5
  }) => Promise<string | undefined>;
@@ -3,6 +3,9 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
 
4
4
  const getTransactionLink = (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, transactionHash, }) {
5
5
  try {
6
+ if (!walletConnector) {
7
+ return undefined;
8
+ }
6
9
  const [blockExplorerUrl] = yield walletConnector.getBlockExplorerUrlsForCurrentNetwork();
7
10
  if (!blockExplorerUrl)
8
11
  return undefined;
@@ -79,3 +79,4 @@ export { useSyncDynamicWaas } from './useSyncDynamicWaas';
79
79
  export { useExchangeAccounts } from './useExchangeAccounts';
80
80
  export { useConnectExchangeForFunding } from './useConnectExchangeForFunding';
81
81
  export { useClientSessionKeys } from './useClientSessionKeys';
82
+ export { useSubmitExchangeFunding } from './useSubmitExchangeFunding';
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
6
+ const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.';
7
7
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
8
8
  const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
9
9
  const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
@@ -1,4 +1,4 @@
1
- export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chains";
1
+ export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.";
2
2
  export declare const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = "Dynamic Waas connector not found";
3
3
  export declare const INVALID_CHAINS_ERROR = "The following chains are not enabled for embedded wallets";
4
4
  export declare const WALLET_CREATION_FAILED_ERROR = "Failed to create wallet account for the following chains";
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
2
+ const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.';
3
3
  const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
4
4
  const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
5
5
  const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
@@ -177,7 +177,7 @@ const useDynamicWaas = () => {
177
177
  if (invalidChains && invalidChains.length) {
178
178
  throw new utils.DynamicError(`${constants.INVALID_CHAINS_ERROR}: ${invalidChains.join(', ')}`);
179
179
  }
180
- const currentVerifiedCredentials = (user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) || [];
180
+ const previousVerifiedCredentials = (user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) || [];
181
181
  const results = yield Promise.allSettled(chainNames.map((chain) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
182
182
  const walletConnector = getWalletConnector(chain);
183
183
  if (!walletConnector)
@@ -185,17 +185,28 @@ const useDynamicWaas = () => {
185
185
  const account = yield walletConnector.createWalletAccount();
186
186
  return Object.assign(Object.assign({}, account), { chainName: chain });
187
187
  })));
188
- const failedChains = chainNames.filter((_, i) => results[i].status === 'rejected');
188
+ const failedChains = [];
189
+ const errors = [];
190
+ results.forEach((result, i) => {
191
+ if (result.status === 'rejected') {
192
+ const chainName = chainNames[i];
193
+ failedChains.push(chainName);
194
+ const errorMessage = result.reason instanceof Error
195
+ ? result.reason.message
196
+ : String(result.reason);
197
+ errors.push(`${chainName}: ${errorMessage}`);
198
+ }
199
+ });
189
200
  if (failedChains.length > 0) {
190
201
  refresh();
191
- throw new utils.DynamicError(`${constants.WALLET_CREATION_FAILED_ERROR}: ${failedChains.join(', ')}`);
202
+ throw new utils.DynamicError(`${constants.WALLET_CREATION_FAILED_ERROR}: ${failedChains.join(', ')}. Errors: ${errors.join('; ')}`);
192
203
  }
193
204
  const createdWalletAccounts = results.map((r) => r.status === 'fulfilled' ? r.value : undefined);
194
205
  const primaryWalletAccount = createdWalletAccounts === null || createdWalletAccounts === void 0 ? void 0 : createdWalletAccounts.find((wallet) => (wallet === null || wallet === void 0 ? void 0 : wallet.chainName) === (primaryChain === null || primaryChain === void 0 ? void 0 : primaryChain.name));
195
206
  const refreshedUser = yield refresh();
196
207
  if (refreshedUser) {
197
208
  // Add new wallet IDs to trigger walletAdded events
198
- const newWalletIds = getNewVerifiedCredentialsFromDiff.getNewVerifiedCredentialsFromDiff(currentVerifiedCredentials, refreshedUser.verifiedCredentials)
209
+ const newWalletIds = getNewVerifiedCredentialsFromDiff.getNewVerifiedCredentialsFromDiff(previousVerifiedCredentials, refreshedUser.verifiedCredentials)
199
210
  .filter(({ format }) => format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain)
200
211
  .map(({ id }) => id);
201
212
  addedWalletsIds.current = addedWalletsIds.current.concat(newWalletIds);
@@ -207,9 +218,12 @@ const useDynamicWaas = () => {
207
218
  ((_c = primaryWalletAccount.accountAddress) === null || _c === void 0 ? void 0 : _c.toLowerCase());
208
219
  });
209
220
  if (createdPrimaryWallet) {
210
- const smartWalletAccount = smartWallet.findSmartWallet(createdPrimaryWallet, refreshedUser.verifiedCredentials);
211
- const walletIdToUse = (smartWalletAccount === null || smartWalletAccount === void 0 ? void 0 : smartWalletAccount.id) || createdPrimaryWallet.id;
212
- updatePrimaryWalletId.updatePrimaryWalletId(walletIdToUse);
221
+ // if the user already has a blockchain wallet, don't update the primary wallet
222
+ if (!previousVerifiedCredentials.find((vc) => vc.format === 'blockchain')) {
223
+ const smartWalletAccount = smartWallet.findSmartWallet(createdPrimaryWallet, refreshedUser.verifiedCredentials);
224
+ const walletIdToUse = (smartWalletAccount === null || smartWalletAccount === void 0 ? void 0 : smartWalletAccount.id) || createdPrimaryWallet.id;
225
+ updatePrimaryWalletId.updatePrimaryWalletId(walletIdToUse);
226
+ }
213
227
  }
214
228
  }
215
229
  }
@@ -225,29 +239,21 @@ const useDynamicWaas = () => {
225
239
  addedWalletsIds,
226
240
  ]);
227
241
  const needsAutoCreateWalletChains = React.useMemo(() => {
228
- const hasDynamicWaasWalletForChain = (chain) => {
229
- var _a;
230
- return (_a = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((wallet) => {
231
- var _a;
232
- return ((_a = wallet.walletName) === null || _a === void 0 ? void 0 : _a.includes('dynamicwaas')) &&
233
- wallet.chain &&
234
- compareChains.compareChains(wallet.chain, chain);
235
- })) !== null && _a !== void 0 ? _a : false;
236
- };
237
- const hasDynamicWaasWalletForAllEnabledChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.every(hasDynamicWaasWalletForChain);
238
- const missingChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.filter((chain) => !hasDynamicWaasWalletForChain(chain));
239
- const hasExistingV1orV2Wallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((wallet) => {
240
- var _a, _b;
241
- return ((_a = wallet.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === sdkApiCore.EmbeddedWalletVersionEnum.V1 || // V1 wallet
242
- ((_b = wallet.walletProperties) === null || _b === void 0 ? void 0 : _b.version) === sdkApiCore.EmbeddedWalletVersionEnum.V2;
243
- });
244
242
  if (!user$1 ||
245
- hasDynamicWaasWalletForAllEnabledChains || // already has a dynamic waas wallet for all enabled chains
246
- !dynamicWaasIsEnabled || // dynamic waas is not enabled
247
- !automaticEmbeddedWalletCreationEnabled || // automatic embedded wallet creation is not enabled
248
- hasExistingV1orV2Wallet // already has a v2 or v1 wallet
249
- )
243
+ !dynamicWaasIsEnabled ||
244
+ !automaticEmbeddedWalletCreationEnabled) {
250
245
  return [];
246
+ }
247
+ // check if user have any wallet (V1, V2, or V3/dynamicwaas) for this chain
248
+ const hasEmbeddedWalletForChain = (chain) => {
249
+ var _a;
250
+ return (_a = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((wallet) => wallet.chain &&
251
+ compareChains.compareChains(wallet.chain, chain) &&
252
+ wallet.walletProvider === sdkApiCore.WalletProviderEnum.EmbeddedWallet)) !== null && _a !== void 0 ? _a : false;
253
+ };
254
+ // For each enabled chain, if user does NOT have a V3 wallet and does NOT have a V1/V2 wallet, add to missing
255
+ const missingChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.filter((chain) => !hasEmbeddedWalletForChain(chain));
256
+ // If user has an external wallet, only create if automaticEmbeddedWalletCreationForExternalEnabled is true
251
257
  const hasExternalWallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((vc) => vc.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain &&
252
258
  vc.walletProvider !== sdkApiCore.WalletProviderEnum.EmbeddedWallet);
253
259
  const shouldCreateDynamicWaasWallet = hasExternalWallet
@@ -173,7 +173,7 @@ const useDynamicWaas = () => {
173
173
  if (invalidChains && invalidChains.length) {
174
174
  throw new DynamicError(`${INVALID_CHAINS_ERROR}: ${invalidChains.join(', ')}`);
175
175
  }
176
- const currentVerifiedCredentials = (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [];
176
+ const previousVerifiedCredentials = (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [];
177
177
  const results = yield Promise.allSettled(chainNames.map((chain) => __awaiter(void 0, void 0, void 0, function* () {
178
178
  const walletConnector = getWalletConnector(chain);
179
179
  if (!walletConnector)
@@ -181,17 +181,28 @@ const useDynamicWaas = () => {
181
181
  const account = yield walletConnector.createWalletAccount();
182
182
  return Object.assign(Object.assign({}, account), { chainName: chain });
183
183
  })));
184
- const failedChains = chainNames.filter((_, i) => results[i].status === 'rejected');
184
+ const failedChains = [];
185
+ const errors = [];
186
+ results.forEach((result, i) => {
187
+ if (result.status === 'rejected') {
188
+ const chainName = chainNames[i];
189
+ failedChains.push(chainName);
190
+ const errorMessage = result.reason instanceof Error
191
+ ? result.reason.message
192
+ : String(result.reason);
193
+ errors.push(`${chainName}: ${errorMessage}`);
194
+ }
195
+ });
185
196
  if (failedChains.length > 0) {
186
197
  refresh();
187
- throw new DynamicError(`${WALLET_CREATION_FAILED_ERROR}: ${failedChains.join(', ')}`);
198
+ throw new DynamicError(`${WALLET_CREATION_FAILED_ERROR}: ${failedChains.join(', ')}. Errors: ${errors.join('; ')}`);
188
199
  }
189
200
  const createdWalletAccounts = results.map((r) => r.status === 'fulfilled' ? r.value : undefined);
190
201
  const primaryWalletAccount = createdWalletAccounts === null || createdWalletAccounts === void 0 ? void 0 : createdWalletAccounts.find((wallet) => (wallet === null || wallet === void 0 ? void 0 : wallet.chainName) === (primaryChain === null || primaryChain === void 0 ? void 0 : primaryChain.name));
191
202
  const refreshedUser = yield refresh();
192
203
  if (refreshedUser) {
193
204
  // Add new wallet IDs to trigger walletAdded events
194
- const newWalletIds = getNewVerifiedCredentialsFromDiff(currentVerifiedCredentials, refreshedUser.verifiedCredentials)
205
+ const newWalletIds = getNewVerifiedCredentialsFromDiff(previousVerifiedCredentials, refreshedUser.verifiedCredentials)
195
206
  .filter(({ format }) => format === JwtVerifiedCredentialFormatEnum.Blockchain)
196
207
  .map(({ id }) => id);
197
208
  addedWalletsIds.current = addedWalletsIds.current.concat(newWalletIds);
@@ -203,9 +214,12 @@ const useDynamicWaas = () => {
203
214
  ((_c = primaryWalletAccount.accountAddress) === null || _c === void 0 ? void 0 : _c.toLowerCase());
204
215
  });
205
216
  if (createdPrimaryWallet) {
206
- const smartWalletAccount = findSmartWallet(createdPrimaryWallet, refreshedUser.verifiedCredentials);
207
- const walletIdToUse = (smartWalletAccount === null || smartWalletAccount === void 0 ? void 0 : smartWalletAccount.id) || createdPrimaryWallet.id;
208
- updatePrimaryWalletId(walletIdToUse);
217
+ // if the user already has a blockchain wallet, don't update the primary wallet
218
+ if (!previousVerifiedCredentials.find((vc) => vc.format === 'blockchain')) {
219
+ const smartWalletAccount = findSmartWallet(createdPrimaryWallet, refreshedUser.verifiedCredentials);
220
+ const walletIdToUse = (smartWalletAccount === null || smartWalletAccount === void 0 ? void 0 : smartWalletAccount.id) || createdPrimaryWallet.id;
221
+ updatePrimaryWalletId(walletIdToUse);
222
+ }
209
223
  }
210
224
  }
211
225
  }
@@ -221,29 +235,21 @@ const useDynamicWaas = () => {
221
235
  addedWalletsIds,
222
236
  ]);
223
237
  const needsAutoCreateWalletChains = useMemo(() => {
224
- const hasDynamicWaasWalletForChain = (chain) => {
225
- var _a;
226
- return (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => {
227
- var _a;
228
- return ((_a = wallet.walletName) === null || _a === void 0 ? void 0 : _a.includes('dynamicwaas')) &&
229
- wallet.chain &&
230
- compareChains(wallet.chain, chain);
231
- })) !== null && _a !== void 0 ? _a : false;
232
- };
233
- const hasDynamicWaasWalletForAllEnabledChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.every(hasDynamicWaasWalletForChain);
234
- const missingChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.filter((chain) => !hasDynamicWaasWalletForChain(chain));
235
- const hasExistingV1orV2Wallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => {
236
- var _a, _b;
237
- return ((_a = wallet.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === EmbeddedWalletVersionEnum.V1 || // V1 wallet
238
- ((_b = wallet.walletProperties) === null || _b === void 0 ? void 0 : _b.version) === EmbeddedWalletVersionEnum.V2;
239
- });
240
238
  if (!user ||
241
- hasDynamicWaasWalletForAllEnabledChains || // already has a dynamic waas wallet for all enabled chains
242
- !dynamicWaasIsEnabled || // dynamic waas is not enabled
243
- !automaticEmbeddedWalletCreationEnabled || // automatic embedded wallet creation is not enabled
244
- hasExistingV1orV2Wallet // already has a v2 or v1 wallet
245
- )
239
+ !dynamicWaasIsEnabled ||
240
+ !automaticEmbeddedWalletCreationEnabled) {
246
241
  return [];
242
+ }
243
+ // check if user have any wallet (V1, V2, or V3/dynamicwaas) for this chain
244
+ const hasEmbeddedWalletForChain = (chain) => {
245
+ var _a;
246
+ return (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => wallet.chain &&
247
+ compareChains(wallet.chain, chain) &&
248
+ wallet.walletProvider === WalletProviderEnum.EmbeddedWallet)) !== null && _a !== void 0 ? _a : false;
249
+ };
250
+ // For each enabled chain, if user does NOT have a V3 wallet and does NOT have a V1/V2 wallet, add to missing
251
+ const missingChains = enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.filter((chain) => !hasEmbeddedWalletForChain(chain));
252
+ // If user has an external wallet, only create if automaticEmbeddedWalletCreationForExternalEnabled is true
247
253
  const hasExternalWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((vc) => vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&
248
254
  vc.walletProvider !== WalletProviderEnum.EmbeddedWallet);
249
255
  const shouldCreateDynamicWaasWallet = hasExternalWallet
@@ -0,0 +1 @@
1
+ export * from './useSubmitExchangeFunding';
@@ -0,0 +1,11 @@
1
+ import { ExchangeKeyEnum } from '@dynamic-labs/sdk-api-core';
2
+ import { ConfirmExchangeTransferViewProps } from '../../../widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView';
3
+ export type SubmitExchangeFundingProps = {
4
+ tokenAmount: string | undefined;
5
+ exchange: ExchangeKeyEnum;
6
+ tokenSymbol: string;
7
+ mfaCode?: string;
8
+ toAddress: string;
9
+ props: ConfirmExchangeTransferViewProps;
10
+ };
11
+ export declare const useSubmitExchangeFunding: () => ({ tokenAmount, exchange, tokenSymbol, mfaCode, toAddress, props, }: SubmitExchangeFundingProps) => Promise<void>;
@@ -15,7 +15,7 @@ var warningRed = require('../../shared/assets/warning-red.cjs');
15
15
  var backup = require('../../shared/assets/backup.cjs');
16
16
  require('../../../../_virtual/_tslib.cjs');
17
17
  require('@dynamic-labs/sdk-api-core');
18
- require('../../shared/logger.cjs');
18
+ var logger = require('../../shared/logger.cjs');
19
19
  require('@dynamic-labs/wallet-connector-core');
20
20
  require('@dynamic-labs/wallet-book');
21
21
  require('@dynamic-labs/utils');
@@ -24,9 +24,8 @@ require('../../utils/constants/values.cjs');
24
24
  require('../../shared/consts/index.cjs');
25
25
  require('../../components/Alert/Alert.cjs');
26
26
  require('../../events/dynamicEvents.cjs');
27
+ var useDynamicContext = require('../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
27
28
  require('../../context/DynamicContext/DynamicContext.cjs');
28
- require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
29
- require('../../store/state/authMode/authMode.cjs');
30
29
  require('../../context/CaptchaContext/CaptchaContext.cjs');
31
30
  require('../../context/ErrorContext/ErrorContext.cjs');
32
31
  require('@dynamic-labs/multi-wallet');
@@ -42,6 +41,8 @@ require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
42
41
  require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
43
42
  require('../../context/AccountExistsContext/AccountExistsContext.cjs');
44
43
  require('../../context/UserWalletsContext/UserWalletsContext.cjs');
44
+ require('../../store/state/authMode/authMode.cjs');
45
+ require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
45
46
  require('../../context/VerificationContext/VerificationContext.cjs');
46
47
  require('react-dom');
47
48
  require('../../utils/functions/compareChains/compareChains.cjs');
@@ -113,6 +114,7 @@ const BackupUnsuccessfulView = () => {
113
114
  const supportEmail = (_a = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
114
115
  const supportUrls = (_b = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
115
116
  const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
117
+ const { handleLogOut } = useDynamicContext.useDynamicContext();
116
118
  const refreshPage = () => {
117
119
  window.location.reload();
118
120
  };
@@ -140,7 +142,15 @@ const BackupUnsuccessfulView = () => {
140
142
  'button-group--with-help-section': hasContactInfo,
141
143
  }), children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'retry-button', buttonVariant: 'brand-primary', type: 'submit', onClick: () => refreshPage(), copykey: 'dyn_waas.backup_unsuccessful.try_again', typographyProps: {
142
144
  color: 'inherit',
143
- }, children: t('dyn_waas.backup_unsuccessful.try_again') }) }), jsxRuntime.jsx("div", { className: 'need-help-section', children: jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}) })] }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { asFooter: true })] }));
145
+ }, children: t('dyn_waas.backup_unsuccessful.try_again') }) }), jsxRuntime.jsx("div", { className: classNames.classNames('button-group', 'logout-group', {
146
+ 'button-group--with-help-section': hasContactInfo,
147
+ }), children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'logout-button', buttonVariant: 'tertiary', type: 'submit', onClick: () => {
148
+ logger.logger.error('BackupUnsuccessfulView: Could not backup wallet, logging out');
149
+ handleLogOut();
150
+ }, copykey: 'dyn_waas.backup_unsuccessful.log_out', typographyProps: {
151
+ color: 'inherit',
152
+ weight: 'medium',
153
+ }, children: t('dyn_waas.backup_unsuccessful.log_out') }) }), jsxRuntime.jsx("div", { className: 'need-help-section', children: jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}) })] }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { asFooter: true })] }));
144
154
  };
145
155
 
146
156
  exports.BackupUnsuccessfulView = BackupUnsuccessfulView;
@@ -11,7 +11,7 @@ import { ReactComponent as SvgWarningRed } from '../../shared/assets/warning-red
11
11
  import { ReactComponent as SvgBackup } from '../../shared/assets/backup.js';
12
12
  import '../../../../_virtual/_tslib.js';
13
13
  import '@dynamic-labs/sdk-api-core';
14
- import '../../shared/logger.js';
14
+ import { logger } from '../../shared/logger.js';
15
15
  import '@dynamic-labs/wallet-connector-core';
16
16
  import '@dynamic-labs/wallet-book';
17
17
  import '@dynamic-labs/utils';
@@ -20,9 +20,8 @@ import '../../utils/constants/values.js';
20
20
  import '../../shared/consts/index.js';
21
21
  import '../../components/Alert/Alert.js';
22
22
  import '../../events/dynamicEvents.js';
23
+ import { useDynamicContext } from '../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
23
24
  import '../../context/DynamicContext/DynamicContext.js';
24
- import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
25
- import '../../store/state/authMode/authMode.js';
26
25
  import '../../context/CaptchaContext/CaptchaContext.js';
27
26
  import '../../context/ErrorContext/ErrorContext.js';
28
27
  import '@dynamic-labs/multi-wallet';
@@ -38,6 +37,8 @@ import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
38
37
  import '../../context/AccessDeniedContext/AccessDeniedContext.js';
39
38
  import '../../context/AccountExistsContext/AccountExistsContext.js';
40
39
  import '../../context/UserWalletsContext/UserWalletsContext.js';
40
+ import '../../store/state/authMode/authMode.js';
41
+ import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
41
42
  import '../../context/VerificationContext/VerificationContext.js';
42
43
  import 'react-dom';
43
44
  import '../../utils/functions/compareChains/compareChains.js';
@@ -109,6 +110,7 @@ const BackupUnsuccessfulView = () => {
109
110
  const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
110
111
  const supportUrls = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _b === void 0 ? void 0 : _b.supportUrls;
111
112
  const hasContactInfo = Boolean(supportEmail || Object.keys(supportUrls || {}).length > 0);
113
+ const { handleLogOut } = useDynamicContext();
112
114
  const refreshPage = () => {
113
115
  window.location.reload();
114
116
  };
@@ -136,7 +138,15 @@ const BackupUnsuccessfulView = () => {
136
138
  'button-group--with-help-section': hasContactInfo,
137
139
  }), children: jsx(TypographyButton, { buttonClassName: 'retry-button', buttonVariant: 'brand-primary', type: 'submit', onClick: () => refreshPage(), copykey: 'dyn_waas.backup_unsuccessful.try_again', typographyProps: {
138
140
  color: 'inherit',
139
- }, children: t('dyn_waas.backup_unsuccessful.try_again') }) }), jsx("div", { className: 'need-help-section', children: jsx(NeedHelpSection, {}) })] }), jsx(PoweredByDynamic, { asFooter: true })] }));
141
+ }, children: t('dyn_waas.backup_unsuccessful.try_again') }) }), jsx("div", { className: classNames('button-group', 'logout-group', {
142
+ 'button-group--with-help-section': hasContactInfo,
143
+ }), children: jsx(TypographyButton, { buttonClassName: 'logout-button', buttonVariant: 'tertiary', type: 'submit', onClick: () => {
144
+ logger.error('BackupUnsuccessfulView: Could not backup wallet, logging out');
145
+ handleLogOut();
146
+ }, copykey: 'dyn_waas.backup_unsuccessful.log_out', typographyProps: {
147
+ color: 'inherit',
148
+ weight: 'medium',
149
+ }, children: t('dyn_waas.backup_unsuccessful.log_out') }) }), jsx("div", { className: 'need-help-section', children: jsx(NeedHelpSection, {}) })] }), jsx(PoweredByDynamic, { asFooter: true })] }));
140
150
  };
141
151
 
142
152
  export { BackupUnsuccessfulView, BackupUnsuccessfulView as default };
@@ -0,0 +1,127 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var Typography = require('../../components/Typography/Typography.cjs');
10
+ var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
11
+ require('@dynamic-labs/utils');
12
+ require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
13
+ var arrowLeft = require('../../shared/assets/arrow-left.cjs');
14
+ var locked = require('../../shared/assets/locked.cjs');
15
+ require('@dynamic-labs/iconic');
16
+ require('../../context/ViewContext/ViewContext.cjs');
17
+ require('../../../../_virtual/_tslib.cjs');
18
+ require('@dynamic-labs/sdk-api-core');
19
+ require('../../shared/logger.cjs');
20
+ require('@dynamic-labs/wallet-connector-core');
21
+ require('@dynamic-labs/wallet-book');
22
+ require('../../utils/constants/colors.cjs');
23
+ require('../../utils/constants/values.cjs');
24
+ require('../../shared/consts/index.cjs');
25
+ require('../../components/Alert/Alert.cjs');
26
+ require('../../events/dynamicEvents.cjs');
27
+ require('../../context/DynamicContext/DynamicContext.cjs');
28
+ require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
29
+ require('../../store/state/authMode/authMode.cjs');
30
+ require('../../context/CaptchaContext/CaptchaContext.cjs');
31
+ require('../../context/ErrorContext/ErrorContext.cjs');
32
+ require('@dynamic-labs/multi-wallet');
33
+ require('react-international-phone');
34
+ require('../../store/state/nonce/nonce.cjs');
35
+ var pixelToRem = require('../../utils/functions/pixelToRem/pixelToRem.cjs');
36
+ require('../../store/state/projectSettings/projectSettings.cjs');
37
+ require('../../config/ApiEndpoint.cjs');
38
+ require('../../store/state/user/user.cjs');
39
+ require('../../locale/locale.cjs');
40
+ require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
41
+ require('../../store/state/primaryWalletId/primaryWalletId.cjs');
42
+ require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
43
+ require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
44
+ require('../../context/AccountExistsContext/AccountExistsContext.cjs');
45
+ require('../../context/UserWalletsContext/UserWalletsContext.cjs');
46
+ require('../../context/VerificationContext/VerificationContext.cjs');
47
+ require('react-dom');
48
+ require('../../utils/functions/compareChains/compareChains.cjs');
49
+ require('../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
50
+ require('../../context/ThemeContext/ThemeContext.cjs');
51
+ require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
52
+ require('bs58');
53
+ require('@dynamic-labs/types');
54
+ require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
55
+ require('../../context/LoadingContext/LoadingContext.cjs');
56
+ require('../../context/WalletContext/WalletContext.cjs');
57
+ require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
58
+ require('yup');
59
+ require('../../context/MockContext/MockContext.cjs');
60
+ require('../CollectUserDataView/useFields.cjs');
61
+ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
62
+ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
63
+ require('@dynamic-labs/rpc-providers');
64
+ require('../../store/state/walletOptions/walletOptions.cjs');
65
+ var PoweredByDynamic = require('../../components/PoweredByDynamic/PoweredByDynamic.cjs');
66
+ require('../../context/FooterAnimationContext/index.cjs');
67
+ require('../../components/ShadowDOM/ShadowDOM.cjs');
68
+ require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
69
+ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
70
+ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
71
+ require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
72
+ require('../../context/WalletGroupContext/WalletGroupContext.cjs');
73
+ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
74
+ require('react-focus-lock');
75
+ var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
76
+ require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
77
+ var IconButton = require('../../components/IconButton/IconButton.cjs');
78
+ require('../../components/MenuList/Dropdown/Dropdown.cjs');
79
+ require('formik');
80
+ require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
81
+ var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
82
+ require('../../store/state/sendBalances.cjs');
83
+ require('../../components/Input/Input.cjs');
84
+ require('../../components/OverlayCard/OverlayCard.cjs');
85
+ require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
86
+ require('../../context/PasskeyContext/PasskeyContext.cjs');
87
+ require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
88
+ require('../../context/OnrampContext/OnrampContext.cjs');
89
+ require('qrcode');
90
+ require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
91
+ require('../../../index.cjs');
92
+ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
93
+ require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
94
+ require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
95
+ require('@hcaptcha/react-hcaptcha');
96
+ require('../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
97
+ require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
98
+ require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
99
+ require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
100
+ require('../../store/state/tokenBalances.cjs');
101
+ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
102
+ require('../../components/InlineWidget/InlineWidget.cjs');
103
+ require('../../components/IsBrowser/IsBrowser.cjs');
104
+ require('../../components/Popper/Popper/Popper.cjs');
105
+ require('../../components/Popper/PopperContext/PopperContext.cjs');
106
+
107
+ const iconSize = 96;
108
+ const MfaExchangeView = ({ onSubmit, onBack }) => {
109
+ const { t } = reactI18next.useTranslation();
110
+ const [mfaCode, setMfaCode] = React.useState('');
111
+ const handleCodeChanged = (event) => {
112
+ const inputCode = event.target.value;
113
+ setMfaCode(inputCode);
114
+ };
115
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => {
116
+ onBack();
117
+ }, children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
118
+ const icon = (jsxRuntime.jsx(locked.ReactComponent, { style: {
119
+ height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
120
+ width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
121
+ } }));
122
+ return (jsxRuntime.jsxs("div", { className: 'mfa-exchange-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', children: t('dyn_exchange_mfa.title') }) }), jsxRuntime.jsxs("div", { className: 'mfa-exchange-view__content', children: [jsxRuntime.jsxs("div", { className: 'mfa-exchange-view__content__icon-description', children: [jsxRuntime.jsx("div", { className: 'mfa-exchange-view__content__icon-description__icon-holder', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, customSpinnerColor: 'black', iconSize: iconSize, className: 'mfa-exchange-view__content__icon-description__icon-holder__icon', isSpinning: true }) }), jsxRuntime.jsx("div", { className: 'mfa-exchange-view__content__icon-description__description-holder', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'mfa-exchange-view__content__icon-description__description-holder__description', color: 'secondary', children: t('dyn_exchange_mfa.description') }) })] }), jsxRuntime.jsx("div", { className: 'mfa-exchange-view__content__input', children: jsxRuntime.jsx("input", { id: 'mfa-input', "data-testid": 'mfa-input', value: mfaCode, onChange: handleCodeChanged, className: 'mfa-exchange-view__content__input__input' }) }), jsxRuntime.jsx("div", { className: 'mfa-exchange-view__content__confirm', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', buttonPadding: 'large', typographyProps: { color: 'white' }, className: 'mfa-exchange-view__content__confirm__button', disabled: mfaCode === '', onClick: () => {
123
+ onSubmit(mfaCode);
124
+ }, children: t('dyn_exchange_mfa.button') }) })] }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { asFooter: true })] }));
125
+ };
126
+
127
+ exports.MfaExchangeView = MfaExchangeView;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ type props = {
3
+ onSubmit: (code: string) => void;
4
+ onBack: () => void;
5
+ };
6
+ export declare const MfaExchangeView: FC<props>;
7
+ export {};