@dynamic-labs/sdk-react-core 4.40.0 → 4.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +1 -2
  6. package/src/lib/components/SendBalanceForm/SendBalanceForm.js +1 -2
  7. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +5 -2
  8. package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +5 -2
  9. package/src/lib/styles/index.shadow.cjs +1 -1
  10. package/src/lib/styles/index.shadow.js +1 -1
  11. package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.cjs +8 -3
  12. package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.js +8 -3
  13. package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +4 -1
  14. package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +4 -1
  15. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +14 -7
  16. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +14 -7
  17. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +7 -3
  18. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +7 -3
  19. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs +6 -2
  20. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js +6 -2
  21. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +17 -85
  22. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +17 -85
  23. package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +11 -7
  24. package/src/lib/views/LoginView/useLoginView/useLoginView.js +11 -7
  25. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +6 -6
  26. package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +6 -6
  27. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +1 -8
  28. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +1 -8
@@ -7,7 +7,7 @@ var values = require('../../constants/values.cjs');
7
7
  var compareChains = require('../compareChains/compareChains.cjs');
8
8
 
9
9
  const findWalletOptionFor = (account, walletOptions) => {
10
- const { walletName } = account;
10
+ const { walletName, chain } = account;
11
11
  if (walletName === 'turnkeyhd' || walletName === 'dynamicwaas') {
12
12
  const chain = account.chain
13
13
  ? values.VerifiedCredentialNameToChainEnum[account.chain]
@@ -19,14 +19,19 @@ const findWalletOptionFor = (account, walletOptions) => {
19
19
  // set to "unknown" if not found in wallet book. We need to use fallback connector for these wallets.
20
20
  // The "unknown" wallet connector is also legacy and should never be used.
21
21
  if (walletName !== 'unknown') {
22
- const wallet = walletOptions.find((wallet) => wallet.key === walletName);
22
+ // The verified credential chain follows a different format than the wallet connector chain
23
+ // so we need first convert
24
+ const walletChain = chain
25
+ ? values.VerifiedCredentialNameToChainEnum[chain]
26
+ : undefined;
27
+ const wallet = walletOptions.find((wallet) => wallet.key === walletName &&
28
+ (!walletChain || wallet.walletConnector.connectedChain === walletChain));
23
29
  if (wallet)
24
30
  return wallet;
25
31
  }
26
32
  // If we cannot find the correct connector for the wallet, we default to the fallback
27
33
  // this way the wallet will appear in user wallets, but will not be able to be interacted with
28
34
  const fallbackOptions = walletOptions.filter((wallet) => wallet.key === 'fallbackconnector');
29
- const { chain } = account;
30
35
  if (chain) {
31
36
  const unknownWallet = fallbackOptions.find(({ walletConnector }) => compareChains.compareChains(walletConnector.connectedChain, chain));
32
37
  if (unknownWallet)
@@ -3,7 +3,7 @@ import { VerifiedCredentialNameToChainEnum } from '../../constants/values.js';
3
3
  import { compareChains } from '../compareChains/compareChains.js';
4
4
 
5
5
  const findWalletOptionFor = (account, walletOptions) => {
6
- const { walletName } = account;
6
+ const { walletName, chain } = account;
7
7
  if (walletName === 'turnkeyhd' || walletName === 'dynamicwaas') {
8
8
  const chain = account.chain
9
9
  ? VerifiedCredentialNameToChainEnum[account.chain]
@@ -15,14 +15,19 @@ const findWalletOptionFor = (account, walletOptions) => {
15
15
  // set to "unknown" if not found in wallet book. We need to use fallback connector for these wallets.
16
16
  // The "unknown" wallet connector is also legacy and should never be used.
17
17
  if (walletName !== 'unknown') {
18
- const wallet = walletOptions.find((wallet) => wallet.key === walletName);
18
+ // The verified credential chain follows a different format than the wallet connector chain
19
+ // so we need first convert
20
+ const walletChain = chain
21
+ ? VerifiedCredentialNameToChainEnum[chain]
22
+ : undefined;
23
+ const wallet = walletOptions.find((wallet) => wallet.key === walletName &&
24
+ (!walletChain || wallet.walletConnector.connectedChain === walletChain));
19
25
  if (wallet)
20
26
  return wallet;
21
27
  }
22
28
  // If we cannot find the correct connector for the wallet, we default to the fallback
23
29
  // this way the wallet will appear in user wallets, but will not be able to be interacted with
24
30
  const fallbackOptions = walletOptions.filter((wallet) => wallet.key === 'fallbackconnector');
25
- const { chain } = account;
26
31
  if (chain) {
27
32
  const unknownWallet = fallbackOptions.find(({ walletConnector }) => compareChains(walletConnector.connectedChain, chain));
28
33
  if (unknownWallet)
@@ -28,7 +28,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
28
28
  // Validate if there is any other wallet with the same group
29
29
  const isThereWalletOptionWithSameGroup = walletOptionList.some((walletOption) => {
30
30
  const isSameGroup = currentWalletOption.group === walletOption.group;
31
- const isDifferentKey = currentWalletOption.key !== walletOption.key;
31
+ // Some WC wallets may have the same key on different chains, so we need to check that chain as well
32
+ const isDifferentKey = currentWalletOption.key !== walletOption.key ||
33
+ currentWalletOption.walletConnector.connectedChain !==
34
+ walletOption.walletConnector.connectedChain;
32
35
  return isSameGroup && isDifferentKey;
33
36
  });
34
37
  // Avoid group creation if there only one wallet in group
@@ -24,7 +24,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
24
24
  // Validate if there is any other wallet with the same group
25
25
  const isThereWalletOptionWithSameGroup = walletOptionList.some((walletOption) => {
26
26
  const isSameGroup = currentWalletOption.group === walletOption.group;
27
- const isDifferentKey = currentWalletOption.key !== walletOption.key;
27
+ // Some WC wallets may have the same key on different chains, so we need to check that chain as well
28
+ const isDifferentKey = currentWalletOption.key !== walletOption.key ||
29
+ currentWalletOption.walletConnector.connectedChain !==
30
+ walletOption.walletConnector.connectedChain;
28
31
  return isSameGroup && isDifferentKey;
29
32
  });
30
33
  // Avoid group creation if there only one wallet in group
@@ -69,8 +69,11 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
69
69
  walletOptions: walletList,
70
70
  });
71
71
  }
72
- let lastUsedWallet;
73
72
  const hasWalletFilter = Boolean(walletsFilter);
73
+ // This is an array because we might have multiple options with the same key
74
+ // this happens on WC wallets for different chains, because the WC wallet book entries for all chains
75
+ // is always in the EVM entry (for historical reasons) and therefore they all share the same EVM entry's key
76
+ const lastUsedWallets = [];
74
77
  const recommendedWalletsList = [];
75
78
  const installedWallets = [];
76
79
  const otherWallets = [];
@@ -78,13 +81,14 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
78
81
  const orderedInputList = orderAndFilterList(walletList, walletsFilter, isWalletConnectList, recommendedWalletKeys);
79
82
  orderedInputList.forEach((wallet) => {
80
83
  if (walletConnectorCore.isEmbeddedConnector(wallet.walletConnector) ||
81
- !wallet.walletConnector.isAvailable)
84
+ !wallet.walletConnector.isAvailable) {
82
85
  return;
86
+ }
83
87
  if (recommendedWalletKeys === null || recommendedWalletKeys === void 0 ? void 0 : recommendedWalletKeys.includes(wallet.key)) {
84
88
  recommendedWalletsList.push(wallet);
85
89
  }
86
90
  else if (lastUsedWalletKey === wallet.key) {
87
- lastUsedWallet = wallet;
91
+ lastUsedWallets.push(wallet);
88
92
  }
89
93
  else if (wallet.isInstalledOnBrowser) {
90
94
  installedWallets.push(wallet);
@@ -93,10 +97,9 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
93
97
  otherWallets.push(wallet);
94
98
  }
95
99
  });
96
- const firstPriorityWallets = [...(lastUsedWallet ? [lastUsedWallet] : [])];
97
100
  const initialWalletsList = [
98
101
  ...recommendedWalletsList,
99
- ...firstPriorityWallets,
102
+ ...lastUsedWallets,
100
103
  ...installedWallets,
101
104
  ...otherWallets,
102
105
  ];
@@ -106,7 +109,7 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
106
109
  // If a filter has been applied we want to add an offset to the number of wallets
107
110
  // to include the installed and last used wallets
108
111
  const updatedNumberOfWalletsToShow = showMoreWalletsWithFilter && hasWalletFilter
109
- ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, firstPriorityWallets.concat(installedWallets), numberOfWalletsToShow)
112
+ ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, lastUsedWallets.concat(installedWallets), numberOfWalletsToShow)
110
113
  : numberOfWalletsToShow;
111
114
  const walletsList = listToDisplay(finalizedWalletList, searchFilter, isWalletConnectList, updatedNumberOfWalletsToShow, hasWalletFilter, loginWithEmail);
112
115
  return {
@@ -125,7 +128,11 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
125
128
  return sortedWalletList;
126
129
  }
127
130
  };
128
- const KEEP_WALLETS_NAME_LIST = ['walletconnect', 'bitcoin.com wallet'];
131
+ const KEEP_WALLETS_NAME_LIST = [
132
+ 'walletconnect',
133
+ 'walletconnect sol',
134
+ 'bitcoin.com wallet',
135
+ ];
129
136
  const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
130
137
  const searchFilter = rawSearchFilter.trim().toLowerCase();
131
138
  const cleanName = (name) => {
@@ -65,8 +65,11 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
65
65
  walletOptions: walletList,
66
66
  });
67
67
  }
68
- let lastUsedWallet;
69
68
  const hasWalletFilter = Boolean(walletsFilter);
69
+ // This is an array because we might have multiple options with the same key
70
+ // this happens on WC wallets for different chains, because the WC wallet book entries for all chains
71
+ // is always in the EVM entry (for historical reasons) and therefore they all share the same EVM entry's key
72
+ const lastUsedWallets = [];
70
73
  const recommendedWalletsList = [];
71
74
  const installedWallets = [];
72
75
  const otherWallets = [];
@@ -74,13 +77,14 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
74
77
  const orderedInputList = orderAndFilterList(walletList, walletsFilter, isWalletConnectList, recommendedWalletKeys);
75
78
  orderedInputList.forEach((wallet) => {
76
79
  if (isEmbeddedConnector(wallet.walletConnector) ||
77
- !wallet.walletConnector.isAvailable)
80
+ !wallet.walletConnector.isAvailable) {
78
81
  return;
82
+ }
79
83
  if (recommendedWalletKeys === null || recommendedWalletKeys === void 0 ? void 0 : recommendedWalletKeys.includes(wallet.key)) {
80
84
  recommendedWalletsList.push(wallet);
81
85
  }
82
86
  else if (lastUsedWalletKey === wallet.key) {
83
- lastUsedWallet = wallet;
87
+ lastUsedWallets.push(wallet);
84
88
  }
85
89
  else if (wallet.isInstalledOnBrowser) {
86
90
  installedWallets.push(wallet);
@@ -89,10 +93,9 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
89
93
  otherWallets.push(wallet);
90
94
  }
91
95
  });
92
- const firstPriorityWallets = [...(lastUsedWallet ? [lastUsedWallet] : [])];
93
96
  const initialWalletsList = [
94
97
  ...recommendedWalletsList,
95
- ...firstPriorityWallets,
98
+ ...lastUsedWallets,
96
99
  ...installedWallets,
97
100
  ...otherWallets,
98
101
  ];
@@ -102,7 +105,7 @@ const walletListBuilder = ({ userWallets, multiWallet, numberOfWalletsToShow, in
102
105
  // If a filter has been applied we want to add an offset to the number of wallets
103
106
  // to include the installed and last used wallets
104
107
  const updatedNumberOfWalletsToShow = showMoreWalletsWithFilter && hasWalletFilter
105
- ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, firstPriorityWallets.concat(installedWallets), numberOfWalletsToShow)
108
+ ? calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(orderedInputList, lastUsedWallets.concat(installedWallets), numberOfWalletsToShow)
106
109
  : numberOfWalletsToShow;
107
110
  const walletsList = listToDisplay(finalizedWalletList, searchFilter, isWalletConnectList, updatedNumberOfWalletsToShow, hasWalletFilter, loginWithEmail);
108
111
  return {
@@ -121,7 +124,11 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
121
124
  return sortedWalletList;
122
125
  }
123
126
  };
124
- const KEEP_WALLETS_NAME_LIST = ['walletconnect', 'bitcoin.com wallet'];
127
+ const KEEP_WALLETS_NAME_LIST = [
128
+ 'walletconnect',
129
+ 'walletconnect sol',
130
+ 'bitcoin.com wallet',
131
+ ];
125
132
  const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
126
133
  const searchFilter = rawSearchFilter.trim().toLowerCase();
127
134
  const cleanName = (name) => {
@@ -23,7 +23,6 @@ require('../../../../events/dynamicEvents.cjs');
23
23
  require('../../../../context/DynamicContext/DynamicContext.cjs');
24
24
  require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
25
25
  require('../../../../store/state/authMode/authMode.cjs');
26
- var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
27
26
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
28
27
  var ErrorContext = require('../../../../context/ErrorContext/ErrorContext.cjs');
29
28
  require('@dynamic-labs/multi-wallet');
@@ -34,6 +33,7 @@ require('@dynamic-labs-sdk/client/core');
34
33
  require('../../../../client/client.cjs');
35
34
  require('@dynamic-labs-sdk/client');
36
35
  require('../../../../config/ApiEndpoint.cjs');
36
+ var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
37
37
  require('@dynamic-labs/locale');
38
38
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
39
39
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -107,7 +107,7 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
107
107
 
108
108
  const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
109
109
  var _a;
110
- const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
110
+ const projectSettings = useProjectSettings.useProjectSettings();
111
111
  const { view, pushView } = ViewContext.useViewContext();
112
112
  const { setVerificationUUID, setDisplayedDestination } = VerificationContext.useVerification();
113
113
  const { setError } = ErrorContext.useErrorContext();
@@ -148,7 +148,11 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
148
148
  setVerificationUUID,
149
149
  setDisplayedDestination,
150
150
  ]);
151
- if (!isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
151
+ if (!projectSettings) {
152
+ logger.logger.debug('Failed to render EmailSignInSection - no project settings');
153
+ return null;
154
+ }
155
+ if (!isEmailProviderEnabled.isEmailProviderEnabled(projectSettings.providers)) {
152
156
  logger.logger.error('Failed to render EmailSignInSection - no sign in provider enabled');
153
157
  return null;
154
158
  }
@@ -19,7 +19,6 @@ import '../../../../events/dynamicEvents.js';
19
19
  import '../../../../context/DynamicContext/DynamicContext.js';
20
20
  import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
21
21
  import '../../../../store/state/authMode/authMode.js';
22
- import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
23
22
  import '../../../../context/CaptchaContext/CaptchaContext.js';
24
23
  import { useErrorContext } from '../../../../context/ErrorContext/ErrorContext.js';
25
24
  import '@dynamic-labs/multi-wallet';
@@ -30,6 +29,7 @@ import '@dynamic-labs-sdk/client/core';
30
29
  import '../../../../client/client.js';
31
30
  import '@dynamic-labs-sdk/client';
32
31
  import '../../../../config/ApiEndpoint.js';
32
+ import { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
33
33
  import '@dynamic-labs/locale';
34
34
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
35
35
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -103,7 +103,7 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
103
103
 
104
104
  const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
105
105
  var _a;
106
- const { projectSettings } = useInternalDynamicContext();
106
+ const projectSettings = useProjectSettings();
107
107
  const { view, pushView } = useViewContext();
108
108
  const { setVerificationUUID, setDisplayedDestination } = useVerification();
109
109
  const { setError } = useErrorContext();
@@ -144,7 +144,11 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
144
144
  setVerificationUUID,
145
145
  setDisplayedDestination,
146
146
  ]);
147
- if (!isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
147
+ if (!projectSettings) {
148
+ logger.debug('Failed to render EmailSignInSection - no project settings');
149
+ return null;
150
+ }
151
+ if (!isEmailProviderEnabled(projectSettings.providers)) {
148
152
  logger.error('Failed to render EmailSignInSection - no sign in provider enabled');
149
153
  return null;
150
154
  }
@@ -23,7 +23,6 @@ require('../../../../events/dynamicEvents.cjs');
23
23
  require('../../../../context/DynamicContext/DynamicContext.cjs');
24
24
  require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
25
25
  require('../../../../store/state/authMode/authMode.cjs');
26
- var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
27
26
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
28
27
  require('../../../../context/ErrorContext/ErrorContext.cjs');
29
28
  require('@dynamic-labs/multi-wallet');
@@ -38,6 +37,7 @@ require('@dynamic-labs-sdk/client/core');
38
37
  require('../../../../client/client.cjs');
39
38
  require('@dynamic-labs-sdk/client');
40
39
  require('../../../../config/ApiEndpoint.cjs');
40
+ var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
41
41
  require('@dynamic-labs/locale');
42
42
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
43
43
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -113,7 +113,7 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
113
113
 
114
114
  const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
115
115
  var _a, _b;
116
- const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
116
+ const projectSettings = useProjectSettings.useProjectSettings();
117
117
  const countriesWithVerification = React.useMemo(() => {
118
118
  const enabledCountries = getSupportedCountriesForVerificationFromProjectSettings.getSupportedCountriesForVerificationFromProjectSettings(projectSettings);
119
119
  // For login, we always want to use only countries with verification supported
@@ -138,6 +138,10 @@ const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
138
138
  phone: phoneData.phone,
139
139
  setInvalidNumberMessage,
140
140
  });
141
+ if (!projectSettings) {
142
+ logger.logger.debug('Failed to render PhoneNumberSignInSection - no project settings');
143
+ return null;
144
+ }
141
145
  if (!isPhoneNumberProviderEnabled.isPhoneNumberProviderEnabled((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [])) {
142
146
  logger.logger.error('Failed to render PhoneNumberSignInSection - no sign in provider enabled');
143
147
  return null;
@@ -19,7 +19,6 @@ import '../../../../events/dynamicEvents.js';
19
19
  import '../../../../context/DynamicContext/DynamicContext.js';
20
20
  import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
21
21
  import '../../../../store/state/authMode/authMode.js';
22
- import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
23
22
  import '../../../../context/CaptchaContext/CaptchaContext.js';
24
23
  import '../../../../context/ErrorContext/ErrorContext.js';
25
24
  import '@dynamic-labs/multi-wallet';
@@ -34,6 +33,7 @@ import '@dynamic-labs-sdk/client/core';
34
33
  import '../../../../client/client.js';
35
34
  import '@dynamic-labs-sdk/client';
36
35
  import '../../../../config/ApiEndpoint.js';
36
+ import { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
37
37
  import '@dynamic-labs/locale';
38
38
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
39
39
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -109,7 +109,7 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
109
109
 
110
110
  const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
111
111
  var _a, _b;
112
- const { projectSettings } = useInternalDynamicContext();
112
+ const projectSettings = useProjectSettings();
113
113
  const countriesWithVerification = useMemo(() => {
114
114
  const enabledCountries = getSupportedCountriesForVerificationFromProjectSettings(projectSettings);
115
115
  // For login, we always want to use only countries with verification supported
@@ -134,6 +134,10 @@ const PhoneNumberSignInSection = ({ isLoading, onSubmit, onSubmitError, }) => {
134
134
  phone: phoneData.phone,
135
135
  setInvalidNumberMessage,
136
136
  });
137
+ if (!projectSettings) {
138
+ logger.debug('Failed to render PhoneNumberSignInSection - no project settings');
139
+ return null;
140
+ }
137
141
  if (!isPhoneNumberProviderEnabled((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [])) {
138
142
  logger.error('Failed to render PhoneNumberSignInSection - no sign in provider enabled');
139
143
  return null;
@@ -5,24 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
8
- require('react');
9
- require('../../../../context/DynamicContext/DynamicContext.cjs');
10
- require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
8
+ require('../../../../utils/constants/values.cjs');
9
+ require('@dynamic-labs/utils');
10
+ require('../../../../../../_virtual/_tslib.cjs');
11
+ require('@dynamic-labs/multi-wallet');
12
+ require('react-international-phone');
13
+ require('../../../../utils/constants/colors.cjs');
11
14
  require('@dynamic-labs/iconic');
12
15
  require('@dynamic-labs/wallet-connector-core');
16
+ require('react');
13
17
  require('../../../../context/ViewContext/ViewContext.cjs');
14
18
  var logger = require('../../../../shared/logger.cjs');
15
19
  require('@dynamic-labs/wallet-book');
16
- require('@dynamic-labs/utils');
17
- require('../../../../utils/constants/colors.cjs');
18
- require('../../../../utils/constants/values.cjs');
19
20
  require('../../../../shared/consts/index.cjs');
20
- require('../../../../events/dynamicEvents.cjs');
21
- require('../../../../../../_virtual/_tslib.cjs');
22
- require('../../../../context/CaptchaContext/CaptchaContext.cjs');
23
- require('../../../../context/ErrorContext/ErrorContext.cjs');
24
- require('@dynamic-labs/multi-wallet');
25
- require('react-international-phone');
26
21
  var getSocialSignInProviderFromString = require('../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs');
27
22
  require('../../../../store/state/nonce/nonce.cjs');
28
23
  var isProviderEnabled = require('../../../../utils/functions/isProviderEnabled/isProviderEnabled.cjs');
@@ -30,86 +25,23 @@ require('@dynamic-labs-sdk/client/core');
30
25
  require('../../../../client/client.cjs');
31
26
  require('@dynamic-labs-sdk/client');
32
27
  require('../../../../config/ApiEndpoint.cjs');
28
+ require('../../../../events/dynamicEvents.cjs');
29
+ var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
33
30
  require('@dynamic-labs/locale');
34
31
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
35
32
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
36
33
  require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
37
- require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
38
- require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
39
- require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
40
- require('../../../../store/state/authMode/authMode.cjs');
41
- require('../../../../context/VerificationContext/VerificationContext.cjs');
42
- require('react-dom');
43
- require('../../../../utils/functions/compareChains/compareChains.cjs');
44
- require('../../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
45
- require('../../../../context/ThemeContext/ThemeContext.cjs');
46
- require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
47
- require('bs58');
48
- require('@dynamic-labs/types');
49
- require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
50
- require('../../../../context/LoadingContext/LoadingContext.cjs');
51
- require('../../../../context/WalletContext/WalletContext.cjs');
52
- require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
53
- require('yup');
54
- require('../../../../context/MockContext/MockContext.cjs');
55
- require('../../../CollectUserDataView/useFields.cjs');
56
- require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
57
- require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
58
- require('@dynamic-labs/rpc-providers');
59
- require('../../../../store/state/walletOptions/walletOptions.cjs');
60
- require('react-i18next');
61
- require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
62
- require('../../../../components/Alert/Alert.cjs');
63
- require('../../../../components/ShadowDOM/ShadowDOM.cjs');
64
- require('../../../../components/IconButton/IconButton.cjs');
65
- require('../../../../components/InlineWidget/InlineWidget.cjs');
66
- require('../../../../components/Input/Input.cjs');
67
- require('../../../../components/IsBrowser/IsBrowser.cjs');
68
- require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
69
- require('../../../../components/OverlayCard/OverlayCard.cjs');
70
- require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
71
- require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
72
- require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
73
- require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
74
- require('../../../../components/Popper/Popper/Popper.cjs');
75
- require('../../../../components/Popper/PopperContext/PopperContext.cjs');
76
- require('react-focus-lock');
77
- require('qrcode');
78
- require('formik');
79
- require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
80
- require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
81
- require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
82
- require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
83
- require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
84
- require('@hcaptcha/react-hcaptcha');
85
- require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
86
- require('../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
87
- require('../../../ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
88
- require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
89
- require('../../../../context/FooterAnimationContext/index.cjs');
90
34
  var MagicSocialSignIn = require('./MagicSocialSignIn/MagicSocialSignIn.cjs');
91
35
  var DynamicSocialSignIn = require('./DynamicSocialSignIn/DynamicSocialSignIn.cjs');
92
- require('../../../MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
93
- require('../../../../context/PasskeyContext/PasskeyContext.cjs');
94
- require('../../../../context/OnrampContext/OnrampContext.cjs');
95
- require('../../../../store/state/sendBalances.cjs');
96
- require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
97
- require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
98
- require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
99
- require('../../../TransactionConfirmationView/TransactionConfirmationView.cjs');
100
- require('../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
101
- require('../../../../../index.cjs');
102
- require('../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
103
- require('../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
104
- require('../../../../store/state/tokenBalances.cjs');
105
- require('../../../../store/state/multichainBalances.cjs');
106
- require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
107
- var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
108
36
 
109
37
  const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
110
38
  var _a, _b, _c;
111
- const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
112
- const providers = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [];
39
+ const projectSettings = useProjectSettings.useProjectSettings();
40
+ if (!projectSettings) {
41
+ logger.logger.debug('Failed to render SocialSignInSection - no project settings');
42
+ return null;
43
+ }
44
+ const providers = (_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [];
113
45
  const componentProps = {
114
46
  collapsedLayout,
115
47
  defaultProvider: getSocialSignInProviderFromString.getSocialSignInProviderFromString(sectionData.defaultItem),
@@ -117,11 +49,11 @@ const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
117
49
  };
118
50
  const isMagicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApiCore.ProviderEnum.MagicLink);
119
51
  if (isMagicEnabled &&
120
- ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
52
+ ((_b = projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
121
53
  sdkApiCore.SignInProviderEnum.MagicLink) {
122
54
  return jsxRuntime.jsx(MagicSocialSignIn.MagicSocialSignIn, Object.assign({}, componentProps));
123
55
  }
124
- if (((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
56
+ if (((_c = projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
125
57
  sdkApiCore.SignInProviderEnum.Dynamic) {
126
58
  return jsxRuntime.jsx(DynamicSocialSignIn.DynamicSocialSignIn, Object.assign({}, componentProps));
127
59
  }