@dynamic-labs/sdk-react-core 0.19.0-alpha.24 → 0.19.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/LogoutButton/LogoutButton.cjs +3 -1
- package/src/lib/components/LogoutButton/LogoutButton.js +3 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +8 -3
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +1 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.js +8 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.cjs +2 -1
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.js +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +5 -4
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +2 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +5 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +5 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +5 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +14 -8
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +14 -8
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.js +5 -0
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +7 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +7 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +10 -6
- package/src/lib/views/EmailVerification/EmailVerification.js +10 -6
- package/src/lib/views/LoginView/LoginView.cjs +4 -1
- package/src/lib/views/LoginView/LoginView.js +4 -1
- package/src/lib/views/LoginView/sections/LoginWidget.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.d.ts +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +2 -1
- package/src/lib/views/LoginView/useLoginView.cjs +2 -2
- package/src/lib/views/LoginView/useLoginView.js +2 -2
- package/src/lib/views/WalletList/WalletList.cjs +2 -1
- package/src/lib/views/WalletList/WalletList.js +2 -1
|
@@ -126,6 +126,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
const signInAccount = (provider, code, verifier, state) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
var _b;
|
|
129
130
|
try {
|
|
130
131
|
const jwt = yield api.signInOAuth(environmentId, provider, {
|
|
131
132
|
code,
|
|
@@ -146,6 +147,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
146
147
|
}
|
|
147
148
|
setCallback('authSuccess');
|
|
148
149
|
yield createUserProfileByJWT(jwt);
|
|
150
|
+
if (!((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
151
|
+
setShowAuthFlow(false);
|
|
152
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
149
155
|
try {
|
|
150
156
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
151
157
|
// if not enabled, it will throw an error.
|
|
@@ -165,7 +171,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
165
171
|
}
|
|
166
172
|
});
|
|
167
173
|
const connectSocialAccount = (provider, validator) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
168
|
-
var
|
|
174
|
+
var _c, _d;
|
|
169
175
|
clearInterval(authWindowInterval.current);
|
|
170
176
|
clearError();
|
|
171
177
|
setIsProcessing(true);
|
|
@@ -184,13 +190,13 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
184
190
|
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: false });
|
|
185
191
|
};
|
|
186
192
|
const handleAuthWindowMessage = (event) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
-
var
|
|
193
|
+
var _e, _f;
|
|
188
194
|
const message = event.data;
|
|
189
195
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
190
196
|
if (isAuthorizationMessage) {
|
|
191
197
|
logger.logger.debug('Message received', { data: message });
|
|
192
198
|
}
|
|
193
|
-
const apiProvider = getProviderByType.getProviderByType((
|
|
199
|
+
const apiProvider = getProviderByType.getProviderByType((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _e !== void 0 ? _e : [], provider);
|
|
194
200
|
if (!(apiProvider === null || apiProvider === void 0 ? void 0 : apiProvider.redirectUrl)) {
|
|
195
201
|
return;
|
|
196
202
|
}
|
|
@@ -216,7 +222,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
216
222
|
return;
|
|
217
223
|
}
|
|
218
224
|
setIsProcessing(true);
|
|
219
|
-
if (!((
|
|
225
|
+
if (!((_f = providersWaitingOauthMessage.current) === null || _f === void 0 ? void 0 : _f[provider])) {
|
|
220
226
|
handleError(types.SocialOAuthErrorCode.SESSION_TIMEOUT, `Connecting ${provider} account session timeout.`);
|
|
221
227
|
return;
|
|
222
228
|
}
|
|
@@ -244,12 +250,12 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
244
250
|
}
|
|
245
251
|
setIsProcessing(false);
|
|
246
252
|
});
|
|
247
|
-
const loginUrl = getOauthLoginUrl.getOauthLoginUrl((
|
|
253
|
+
const loginUrl = getOauthLoginUrl.getOauthLoginUrl((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _c !== void 0 ? _c : [], provider);
|
|
248
254
|
if (!loginUrl) {
|
|
249
255
|
handleError(types.SocialOAuthErrorCode.NO_OAUTH_URL, `Failed to get login url to connect social account: ${provider}`);
|
|
250
256
|
return;
|
|
251
257
|
}
|
|
252
|
-
if (!((
|
|
258
|
+
if (!((_d = providersWaitingOauthMessage.current) === null || _d === void 0 ? void 0 : _d[provider])) {
|
|
253
259
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
254
260
|
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: true });
|
|
255
261
|
}
|
|
@@ -292,10 +298,10 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
292
298
|
shouldPool.current = true;
|
|
293
299
|
poolOauthResult(provider, state);
|
|
294
300
|
authWindowInterval.current = setInterval(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
295
|
-
var
|
|
301
|
+
var _g;
|
|
296
302
|
shouldPool.current = false;
|
|
297
303
|
// clear all states/listeners, assuming user closed the window before completing oauth
|
|
298
|
-
if ((
|
|
304
|
+
if ((_g = providersWaitingOauthMessage.current) === null || _g === void 0 ? void 0 : _g[provider]) {
|
|
299
305
|
clearListeners();
|
|
300
306
|
handleError(types.SocialOAuthErrorCode.OAUTH_WINDOW_TIMEOUT, `Connecting ${provider} account window timeout.`);
|
|
301
307
|
}
|
|
@@ -122,6 +122,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
const signInAccount = (provider, code, verifier, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
var _b;
|
|
125
126
|
try {
|
|
126
127
|
const jwt = yield signInOAuth(environmentId, provider, {
|
|
127
128
|
code,
|
|
@@ -142,6 +143,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
142
143
|
}
|
|
143
144
|
setCallback('authSuccess');
|
|
144
145
|
yield createUserProfileByJWT(jwt);
|
|
146
|
+
if (!((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
147
|
+
setShowAuthFlow(false);
|
|
148
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
145
151
|
try {
|
|
146
152
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
147
153
|
// if not enabled, it will throw an error.
|
|
@@ -161,7 +167,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
161
167
|
}
|
|
162
168
|
});
|
|
163
169
|
const connectSocialAccount = (provider, validator) => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
-
var
|
|
170
|
+
var _c, _d;
|
|
165
171
|
clearInterval(authWindowInterval.current);
|
|
166
172
|
clearError();
|
|
167
173
|
setIsProcessing(true);
|
|
@@ -180,13 +186,13 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
180
186
|
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: false });
|
|
181
187
|
};
|
|
182
188
|
const handleAuthWindowMessage = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
-
var
|
|
189
|
+
var _e, _f;
|
|
184
190
|
const message = event.data;
|
|
185
191
|
const isAuthorizationMessage = (message === null || message === void 0 ? void 0 : message.type) === 'authorization_response';
|
|
186
192
|
if (isAuthorizationMessage) {
|
|
187
193
|
logger.debug('Message received', { data: message });
|
|
188
194
|
}
|
|
189
|
-
const apiProvider = getProviderByType((
|
|
195
|
+
const apiProvider = getProviderByType((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _e !== void 0 ? _e : [], provider);
|
|
190
196
|
if (!(apiProvider === null || apiProvider === void 0 ? void 0 : apiProvider.redirectUrl)) {
|
|
191
197
|
return;
|
|
192
198
|
}
|
|
@@ -212,7 +218,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
212
218
|
return;
|
|
213
219
|
}
|
|
214
220
|
setIsProcessing(true);
|
|
215
|
-
if (!((
|
|
221
|
+
if (!((_f = providersWaitingOauthMessage.current) === null || _f === void 0 ? void 0 : _f[provider])) {
|
|
216
222
|
handleError(SocialOAuthErrorCode.SESSION_TIMEOUT, `Connecting ${provider} account session timeout.`);
|
|
217
223
|
return;
|
|
218
224
|
}
|
|
@@ -240,12 +246,12 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
240
246
|
}
|
|
241
247
|
setIsProcessing(false);
|
|
242
248
|
});
|
|
243
|
-
const loginUrl = getOauthLoginUrl((
|
|
249
|
+
const loginUrl = getOauthLoginUrl((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _c !== void 0 ? _c : [], provider);
|
|
244
250
|
if (!loginUrl) {
|
|
245
251
|
handleError(SocialOAuthErrorCode.NO_OAUTH_URL, `Failed to get login url to connect social account: ${provider}`);
|
|
246
252
|
return;
|
|
247
253
|
}
|
|
248
|
-
if (!((
|
|
254
|
+
if (!((_d = providersWaitingOauthMessage.current) === null || _d === void 0 ? void 0 : _d[provider])) {
|
|
249
255
|
window.addEventListener('message', handleAuthWindowMessage);
|
|
250
256
|
providersWaitingOauthMessage.current = Object.assign(Object.assign({}, providersWaitingOauthMessage.current), { [provider]: true });
|
|
251
257
|
}
|
|
@@ -288,10 +294,10 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
288
294
|
shouldPool.current = true;
|
|
289
295
|
poolOauthResult(provider, state);
|
|
290
296
|
authWindowInterval.current = setInterval(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
291
|
-
var
|
|
297
|
+
var _g;
|
|
292
298
|
shouldPool.current = false;
|
|
293
299
|
// clear all states/listeners, assuming user closed the window before completing oauth
|
|
294
|
-
if ((
|
|
300
|
+
if ((_g = providersWaitingOauthMessage.current) === null || _g === void 0 ? void 0 : _g[provider]) {
|
|
295
301
|
clearListeners();
|
|
296
302
|
handleError(SocialOAuthErrorCode.OAUTH_WINDOW_TIMEOUT, `Connecting ${provider} account window timeout.`);
|
|
297
303
|
}
|
|
@@ -17,6 +17,7 @@ require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
17
17
|
require('viem');
|
|
18
18
|
require('../../../shared/consts/index.cjs');
|
|
19
19
|
var useWalletConnectorEvent = require('../useWalletConnectorEvent/useWalletConnectorEvent.cjs');
|
|
20
|
+
var sortAccountsByPrimaryWallet = require('./utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.cjs');
|
|
20
21
|
|
|
21
22
|
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
22
23
|
const [loadingNetwork, setLoadingNetwork] = React.useState(true);
|
|
@@ -64,7 +65,11 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
64
65
|
// change the api here
|
|
65
66
|
if (!primaryWallet)
|
|
66
67
|
return;
|
|
67
|
-
|
|
68
|
+
// Sorts the accounts so that the primary wallet is always first
|
|
69
|
+
// when multiWallet is disabled to ensure we find the primary address
|
|
70
|
+
const [newAddress] = multiWallet
|
|
71
|
+
? accounts
|
|
72
|
+
: sortAccountsByPrimaryWallet.sortAccountsByPrimaryWallet(accounts, primaryWallet);
|
|
68
73
|
const newWallet = secondaryWallets.find((wallet) => walletConnectorCore.isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
69
74
|
if (authMode === 'connect-only') {
|
|
70
75
|
refreshConnectedWallet(primaryWallet.id, primaryWallet.connector);
|
|
@@ -13,6 +13,7 @@ import '../../../shared/utils/classes/storage/localStorage.js';
|
|
|
13
13
|
import 'viem';
|
|
14
14
|
import '../../../shared/consts/index.js';
|
|
15
15
|
import { useWalletConnectorEvent } from '../useWalletConnectorEvent/useWalletConnectorEvent.js';
|
|
16
|
+
import { sortAccountsByPrimaryWallet } from './utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.js';
|
|
16
17
|
|
|
17
18
|
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
18
19
|
const [loadingNetwork, setLoadingNetwork] = useState(true);
|
|
@@ -60,7 +61,11 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
60
61
|
// change the api here
|
|
61
62
|
if (!primaryWallet)
|
|
62
63
|
return;
|
|
63
|
-
|
|
64
|
+
// Sorts the accounts so that the primary wallet is always first
|
|
65
|
+
// when multiWallet is disabled to ensure we find the primary address
|
|
66
|
+
const [newAddress] = multiWallet
|
|
67
|
+
? accounts
|
|
68
|
+
: sortAccountsByPrimaryWallet(accounts, primaryWallet);
|
|
64
69
|
const newWallet = secondaryWallets.find((wallet) => isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
65
70
|
if (authMode === 'connect-only') {
|
|
66
71
|
refreshConnectedWallet(primaryWallet.id, primaryWallet.connector);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sortAccountsByPrimaryWallet';
|
package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sortAccountsByPrimaryWallet } from './sortAccountsByPrimaryWallet';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
|
+
|
|
7
|
+
const sortAccountsByPrimaryWallet = (accounts, primaryWallet) => [...accounts].sort((account) => walletConnectorCore.isSameAddress(account, primaryWallet.address, primaryWallet.chain) ? -1 : 1);
|
|
8
|
+
|
|
9
|
+
exports.sortAccountsByPrimaryWallet = sortAccountsByPrimaryWallet;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
|
|
3
|
+
const sortAccountsByPrimaryWallet = (accounts, primaryWallet) => [...accounts].sort((account) => isSameAddress(account, primaryWallet.address, primaryWallet.chain) ? -1 : 1);
|
|
4
|
+
|
|
5
|
+
export { sortAccountsByPrimaryWallet };
|
|
@@ -64,7 +64,7 @@ require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
|
64
64
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
65
65
|
|
|
66
66
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
67
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, projectSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
68
68
|
const { setView, view } = ViewContext.useViewContext();
|
|
69
69
|
const { createEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
70
70
|
const decodedJwt = decodeJwt.decodeJwt(onboardingOnlyJwt);
|
|
@@ -72,6 +72,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
72
72
|
validationSchemaStripUnknown: false,
|
|
73
73
|
});
|
|
74
74
|
const onSubmit = React.useCallback((formValues) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
var _a;
|
|
75
76
|
const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
|
|
76
77
|
if (isEmailVerificationRequired &&
|
|
77
78
|
missingFields.map((field) => field.name).toString() === 'email') {
|
|
@@ -85,6 +86,10 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
88
|
setCallback('authSuccess');
|
|
89
|
+
if (!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation)) {
|
|
90
|
+
setShowAuthFlow(false);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
88
93
|
try {
|
|
89
94
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
90
95
|
// if not enabled, it will throw an error.
|
|
@@ -100,6 +105,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
100
105
|
view,
|
|
101
106
|
createEmbeddedWallet,
|
|
102
107
|
setShowAuthFlow,
|
|
108
|
+
projectSettings,
|
|
103
109
|
]);
|
|
104
110
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm.useUserDataForm({
|
|
105
111
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
@@ -60,7 +60,7 @@ import '../../../components/InlineWidget/InlineWidget.js';
|
|
|
60
60
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
61
61
|
|
|
62
62
|
const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
63
|
-
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext();
|
|
63
|
+
const { policiesConsentInnerComponent, onboardingOnlyJwt, setShowAuthFlow, setCallback, projectSettings, } = useInternalDynamicContext();
|
|
64
64
|
const { setView, view } = useViewContext();
|
|
65
65
|
const { createEmbeddedWallet } = useEmbeddedWallet();
|
|
66
66
|
const decodedJwt = decodeJwt(onboardingOnlyJwt);
|
|
@@ -68,6 +68,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
68
68
|
validationSchemaStripUnknown: false,
|
|
69
69
|
});
|
|
70
70
|
const onSubmit = useCallback((formValues) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
var _a;
|
|
71
72
|
const { isEmailVerificationRequired, missingFields } = yield updateUser(formValues);
|
|
72
73
|
if (isEmailVerificationRequired &&
|
|
73
74
|
missingFields.map((field) => field.name).toString() === 'email') {
|
|
@@ -81,6 +82,10 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
setCallback('authSuccess');
|
|
85
|
+
if (!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation)) {
|
|
86
|
+
setShowAuthFlow(false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
84
89
|
try {
|
|
85
90
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
86
91
|
// if not enabled, it will throw an error.
|
|
@@ -96,6 +101,7 @@ const OnboardingUserDataForm = ({ children, userProfile, disableSubmit, }) => {
|
|
|
96
101
|
view,
|
|
97
102
|
createEmbeddedWallet,
|
|
98
103
|
setShowAuthFlow,
|
|
104
|
+
projectSettings,
|
|
99
105
|
]);
|
|
100
106
|
const { fetch: loading, formikInitialValues, formikValidationSchema, enforcePolicies, onFormSubmit, } = useUserDataForm({
|
|
101
107
|
fields: (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) || [],
|
|
@@ -138,12 +138,14 @@ const EmailVerification = () => {
|
|
|
138
138
|
if (nextView === 'verified-and-transferred') {
|
|
139
139
|
setShowTransferMessage(true);
|
|
140
140
|
}
|
|
141
|
+
if (!((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation)) {
|
|
142
|
+
setShowAuthFlow(false);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
141
145
|
try {
|
|
142
146
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
143
147
|
// if not enabled, it will throw an error.
|
|
144
|
-
|
|
145
|
-
yield createEmbeddedWallet();
|
|
146
|
-
}
|
|
148
|
+
yield createEmbeddedWallet();
|
|
147
149
|
}
|
|
148
150
|
catch (e) {
|
|
149
151
|
setShowAuthFlow(false);
|
|
@@ -210,12 +212,14 @@ const EmailVerification = () => {
|
|
|
210
212
|
// this timeout is set to make sure that the user will see success message
|
|
211
213
|
yield sleepToShowSuccessMessage();
|
|
212
214
|
yield createUserProfileByJWT(jwt);
|
|
215
|
+
if (!((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.automaticEmbeddedWalletCreation)) {
|
|
216
|
+
setShowAuthFlow(false);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
213
219
|
try {
|
|
214
220
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
215
221
|
// if not enabled, it will throw an error.
|
|
216
|
-
|
|
217
|
-
yield createEmbeddedWallet();
|
|
218
|
-
}
|
|
222
|
+
yield createEmbeddedWallet();
|
|
219
223
|
}
|
|
220
224
|
catch (e) {
|
|
221
225
|
setShowAuthFlow(false);
|
|
@@ -134,12 +134,14 @@ const EmailVerification = () => {
|
|
|
134
134
|
if (nextView === 'verified-and-transferred') {
|
|
135
135
|
setShowTransferMessage(true);
|
|
136
136
|
}
|
|
137
|
+
if (!((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation)) {
|
|
138
|
+
setShowAuthFlow(false);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
137
141
|
try {
|
|
138
142
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
139
143
|
// if not enabled, it will throw an error.
|
|
140
|
-
|
|
141
|
-
yield createEmbeddedWallet();
|
|
142
|
-
}
|
|
144
|
+
yield createEmbeddedWallet();
|
|
143
145
|
}
|
|
144
146
|
catch (e) {
|
|
145
147
|
setShowAuthFlow(false);
|
|
@@ -206,12 +208,14 @@ const EmailVerification = () => {
|
|
|
206
208
|
// this timeout is set to make sure that the user will see success message
|
|
207
209
|
yield sleepToShowSuccessMessage();
|
|
208
210
|
yield createUserProfileByJWT(jwt);
|
|
211
|
+
if (!((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _d === void 0 ? void 0 : _d.automaticEmbeddedWalletCreation)) {
|
|
212
|
+
setShowAuthFlow(false);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
209
215
|
try {
|
|
210
216
|
// this function will check turnkey wallet enabled and create wallet if needed
|
|
211
217
|
// if not enabled, it will throw an error.
|
|
212
|
-
|
|
213
|
-
yield createEmbeddedWallet();
|
|
214
|
-
}
|
|
218
|
+
yield createEmbeddedWallet();
|
|
215
219
|
}
|
|
216
220
|
catch (e) {
|
|
217
221
|
setShowAuthFlow(false);
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
7
8
|
var Divider = require('../../components/Divider/Divider.cjs');
|
|
8
9
|
var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
|
|
9
10
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
@@ -17,6 +18,7 @@ var SocialSignInSection = require('./sections/SocialSignInSection/SocialSignInSe
|
|
|
17
18
|
var useLoginView = require('./useLoginView.cjs');
|
|
18
19
|
|
|
19
20
|
const LoginView = () => {
|
|
21
|
+
var _a;
|
|
20
22
|
const { error } = ErrorContext.useErrorContext();
|
|
21
23
|
const { loading } = LoadingContext.useLoadingContext();
|
|
22
24
|
const { view, setView } = ViewContext.useViewContext();
|
|
@@ -40,6 +42,7 @@ const LoginView = () => {
|
|
|
40
42
|
setShowWalletList(false);
|
|
41
43
|
}
|
|
42
44
|
}, [isWalletOnly, view]);
|
|
45
|
+
const numOfWallets = ((_a = logingViewSections.find((section) => section.type === sdkApi.SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
|
|
43
46
|
const renderViewSections = React.useMemo(() => logingViewSections.map((viewSection, index) => {
|
|
44
47
|
switch (viewSection.type) {
|
|
45
48
|
case 'separator':
|
|
@@ -52,7 +55,7 @@ const LoginView = () => {
|
|
|
52
55
|
setShowWalletList(true);
|
|
53
56
|
}, isLoading: isLoading }, `${viewSection.type}_${index}`));
|
|
54
57
|
case 'social':
|
|
55
|
-
return (jsxRuntime.jsx(SocialSignInSection.SocialSignInSection, { sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
58
|
+
return (jsxRuntime.jsx(SocialSignInSection.SocialSignInSection, { collapsedLayout: numOfWallets > 1, sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
56
59
|
default:
|
|
57
60
|
return null;
|
|
58
61
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import { SdkViewSectionType } from '@dynamic-labs/sdk-api';
|
|
3
4
|
import { Divider } from '../../components/Divider/Divider.js';
|
|
4
5
|
import { useErrorContext } from '../../context/ErrorContext/ErrorContext.js';
|
|
5
6
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
@@ -13,6 +14,7 @@ import { SocialSignInSection } from './sections/SocialSignInSection/SocialSignIn
|
|
|
13
14
|
import { useLoginView } from './useLoginView.js';
|
|
14
15
|
|
|
15
16
|
const LoginView = () => {
|
|
17
|
+
var _a;
|
|
16
18
|
const { error } = useErrorContext();
|
|
17
19
|
const { loading } = useLoadingContext();
|
|
18
20
|
const { view, setView } = useViewContext();
|
|
@@ -36,6 +38,7 @@ const LoginView = () => {
|
|
|
36
38
|
setShowWalletList(false);
|
|
37
39
|
}
|
|
38
40
|
}, [isWalletOnly, view]);
|
|
41
|
+
const numOfWallets = ((_a = logingViewSections.find((section) => section.type === SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
|
|
39
42
|
const renderViewSections = useMemo(() => logingViewSections.map((viewSection, index) => {
|
|
40
43
|
switch (viewSection.type) {
|
|
41
44
|
case 'separator':
|
|
@@ -48,7 +51,7 @@ const LoginView = () => {
|
|
|
48
51
|
setShowWalletList(true);
|
|
49
52
|
}, isLoading: isLoading }, `${viewSection.type}_${index}`));
|
|
50
53
|
case 'social':
|
|
51
|
-
return (jsx(SocialSignInSection, { sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
54
|
+
return (jsx(SocialSignInSection, { collapsedLayout: numOfWallets > 1, sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
52
55
|
default:
|
|
53
56
|
return null;
|
|
54
57
|
}
|
|
@@ -60,7 +60,7 @@ require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
60
60
|
var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.cjs');
|
|
61
61
|
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
62
62
|
|
|
63
|
-
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
63
|
+
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
64
64
|
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
65
65
|
const { setSocialProvider, socialProvider, enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
66
66
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
@@ -81,7 +81,7 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
|
81
81
|
setShowAuthFlow(true);
|
|
82
82
|
connectSocialAccount(providerEnum);
|
|
83
83
|
};
|
|
84
|
-
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
84
|
+
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
exports.DynamicSocialSignIn = DynamicSocialSignIn;
|
|
@@ -56,7 +56,7 @@ import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
56
56
|
import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignIn.js';
|
|
57
57
|
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
58
58
|
|
|
59
|
-
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
59
|
+
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
60
60
|
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
61
61
|
const { setSocialProvider, socialProvider, enabledSocialProviders } = useSocialRedirectContext();
|
|
62
62
|
const { setView, goToInitialView } = useViewContext();
|
|
@@ -77,7 +77,7 @@ const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
|
77
77
|
setShowAuthFlow(true);
|
|
78
78
|
connectSocialAccount(providerEnum);
|
|
79
79
|
};
|
|
80
|
-
return (jsx(SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
80
|
+
return (jsx(SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export { DynamicSocialSignIn };
|
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs
CHANGED
|
@@ -60,7 +60,7 @@ require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
60
60
|
var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.cjs');
|
|
61
61
|
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
62
62
|
|
|
63
|
-
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
63
|
+
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
64
64
|
const { socialProvidersFilter = (providers) => providers } = useInternalDynamicContext.useInternalDynamicContext();
|
|
65
65
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = SocialRedirectContext.useSocialRedirectContext();
|
|
66
66
|
const socialProviders = socialProvidersFilter(enabledSocialProviders);
|
|
@@ -69,7 +69,7 @@ const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
|
69
69
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
70
70
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
71
71
|
}));
|
|
72
|
-
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
72
|
+
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
exports.MagicSocialSignIn = MagicSocialSignIn;
|
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js
CHANGED
|
@@ -56,7 +56,7 @@ import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
56
56
|
import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignIn.js';
|
|
57
57
|
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
58
58
|
|
|
59
|
-
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
59
|
+
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
60
60
|
const { socialProvidersFilter = (providers) => providers } = useInternalDynamicContext();
|
|
61
61
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = useSocialRedirectContext();
|
|
62
62
|
const socialProviders = socialProvidersFilter(enabledSocialProviders);
|
|
@@ -65,7 +65,7 @@ const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
|
65
65
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
66
66
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
67
67
|
}));
|
|
68
|
-
return (jsx(SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
68
|
+
return (jsx(SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay, collapsedLayout: collapsedLayout }));
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export { MagicSocialSignIn };
|
|
@@ -22,11 +22,12 @@ var getSocialSignInProviderFromString = require('../../../../utils/functions/get
|
|
|
22
22
|
var MagicSocialSignIn = require('./MagicSocialSignIn/MagicSocialSignIn.cjs');
|
|
23
23
|
var DynamicSocialSignIn = require('./DynamicSocialSignIn/DynamicSocialSignIn.cjs');
|
|
24
24
|
|
|
25
|
-
const SocialSignInSection = ({ sectionData }) => {
|
|
25
|
+
const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
|
|
26
26
|
var _a, _b, _c;
|
|
27
27
|
const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
28
28
|
const providers = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [];
|
|
29
29
|
const componentProps = {
|
|
30
|
+
collapsedLayout,
|
|
30
31
|
defaultProvider: getSocialSignInProviderFromString.getSocialSignInProviderFromString(sectionData.defaultItem),
|
|
31
32
|
numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
|
|
32
33
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { SdkViewSection } from '@dynamic-labs/sdk-api';
|
|
3
3
|
type Props = {
|
|
4
4
|
sectionData: SdkViewSection;
|
|
5
|
+
collapsedLayout?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const SocialSignInSection: ({ sectionData }: Props) => JSX.Element | null;
|
|
7
|
+
export declare const SocialSignInSection: ({ sectionData, collapsedLayout, }: Props) => JSX.Element | null;
|
|
7
8
|
export {};
|
|
@@ -18,11 +18,12 @@ import { getSocialSignInProviderFromString } from '../../../../utils/functions/g
|
|
|
18
18
|
import { MagicSocialSignIn } from './MagicSocialSignIn/MagicSocialSignIn.js';
|
|
19
19
|
import { DynamicSocialSignIn } from './DynamicSocialSignIn/DynamicSocialSignIn.js';
|
|
20
20
|
|
|
21
|
-
const SocialSignInSection = ({ sectionData }) => {
|
|
21
|
+
const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
|
|
22
22
|
var _a, _b, _c;
|
|
23
23
|
const { projectSettings } = useInternalDynamicContext();
|
|
24
24
|
const providers = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [];
|
|
25
25
|
const componentProps = {
|
|
26
|
+
collapsedLayout,
|
|
26
27
|
defaultProvider: getSocialSignInProviderFromString(sectionData.defaultItem),
|
|
27
28
|
numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
|
|
28
29
|
};
|
|
@@ -24,14 +24,14 @@ var index = require('../../utils/functions/getEnabledProviders/index.cjs');
|
|
|
24
24
|
/* eslint-disable multiline-comment-style */
|
|
25
25
|
const NUMBER_OF_WALLETS = 3;
|
|
26
26
|
const useLoginView = () => {
|
|
27
|
-
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
27
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
28
28
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
29
29
|
* Should filter out embedded wallets
|
|
30
30
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
31
31
|
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
32
32
|
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
33
33
|
*/
|
|
34
|
-
const selectableWallets = wallets.filter(({ key }) => key !== 'turnkey');
|
|
34
|
+
const selectableWallets = (walletsFilter ? walletsFilter(wallets) : wallets).filter(({ key }) => key !== 'turnkey');
|
|
35
35
|
const { t } = reactI18next.useTranslation();
|
|
36
36
|
const hasEnabledProviders = Boolean(index.getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
|
|
37
37
|
const isWalletOnly = React.useMemo(() => {
|
|
@@ -20,14 +20,14 @@ import { getEnabledProviders } from '../../utils/functions/getEnabledProviders/i
|
|
|
20
20
|
/* eslint-disable multiline-comment-style */
|
|
21
21
|
const NUMBER_OF_WALLETS = 3;
|
|
22
22
|
const useLoginView = () => {
|
|
23
|
-
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, } = useInternalDynamicContext();
|
|
23
|
+
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext();
|
|
24
24
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
25
25
|
* Should filter out embedded wallets
|
|
26
26
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
27
27
|
* will actually be rendered. It would be especially bad to only have for ex "turnkey" in
|
|
28
28
|
* wallets and then display an empty wallet list (since turnkey doesn't render)
|
|
29
29
|
*/
|
|
30
|
-
const selectableWallets = wallets.filter(({ key }) => key !== 'turnkey');
|
|
30
|
+
const selectableWallets = (walletsFilter ? walletsFilter(wallets) : wallets).filter(({ key }) => key !== 'turnkey');
|
|
31
31
|
const { t } = useTranslation();
|
|
32
32
|
const hasEnabledProviders = Boolean(getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
|
|
33
33
|
const isWalletOnly = useMemo(() => {
|
|
@@ -53,9 +53,10 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
53
53
|
multiWallet,
|
|
54
54
|
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
55
55
|
searchFilter: filterValue,
|
|
56
|
+
showMoreWalletsWithFilter: true,
|
|
56
57
|
signWithEmailWalletName,
|
|
57
58
|
walletBook: walletBook$1,
|
|
58
|
-
walletsFilter
|
|
59
|
+
walletsFilter,
|
|
59
60
|
});
|
|
60
61
|
const isSearchEnabled = numberOfWallets > defaultNumberOfWalletsToShow &&
|
|
61
62
|
walletsList.length !== numberOfWallets;
|