@dynamic-labs/sdk-react-core 2.1.0-alpha.27 → 2.1.0-alpha.28
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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs → SyncAuthFlow/SyncAuthFlow.cjs} +12 -65
- package/src/lib/components/SyncAuthFlow/SyncAuthFlow.d.ts +1 -0
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js → SyncAuthFlow/SyncAuthFlow.js} +12 -65
- package/src/lib/components/SyncAuthFlow/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -5
- package/src/lib/context/DynamicContext/types/index.d.ts +3 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +1 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +1 -0
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +0 -28
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -28
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +0 -16
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +0 -16
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +2 -10
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +2 -10
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +139 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +135 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/index.d.ts +1 -0
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.cjs +85 -3
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.js +85 -3
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +7 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +8 -2
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.d.ts +0 -1
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs +0 -20
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js +0 -16
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/index.d.ts +0 -1
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.d.ts +0 -3
|
@@ -34,22 +34,6 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
34
34
|
copykey: 'dyn_login.helper.wallet_only',
|
|
35
35
|
heading: t('dyn_login.helper.wallet_only'),
|
|
36
36
|
},
|
|
37
|
-
'mfa-choose-device': {
|
|
38
|
-
copykey: 'dyn_mfa.choose_device_view.title',
|
|
39
|
-
heading: t('dyn_mfa.choose_device_view.title'),
|
|
40
|
-
},
|
|
41
|
-
'mfa-recovery': {
|
|
42
|
-
copykey: 'dyn_mfa.recovery_view.helper.title',
|
|
43
|
-
heading: t('dyn_mfa.recovery_view.helper.title'),
|
|
44
|
-
},
|
|
45
|
-
'mfa-secure-device': {
|
|
46
|
-
copykey: 'dyn_mfa.secure_device_view.helper.title',
|
|
47
|
-
heading: t('dyn_mfa.secure_device_view.helper.title'),
|
|
48
|
-
},
|
|
49
|
-
'mfa-verification': {
|
|
50
|
-
copykey: 'dyn_mfa.otp_verification_view.title',
|
|
51
|
-
heading: t('dyn_mfa.otp_verification_view.title'),
|
|
52
|
-
},
|
|
53
37
|
'passkey-intro': {
|
|
54
38
|
copykey: 'dyn_passkey_intro.helper.title',
|
|
55
39
|
heading: t('dyn_passkey_intro.helper.title'),
|
|
@@ -30,22 +30,6 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
30
30
|
copykey: 'dyn_login.helper.wallet_only',
|
|
31
31
|
heading: t('dyn_login.helper.wallet_only'),
|
|
32
32
|
},
|
|
33
|
-
'mfa-choose-device': {
|
|
34
|
-
copykey: 'dyn_mfa.choose_device_view.title',
|
|
35
|
-
heading: t('dyn_mfa.choose_device_view.title'),
|
|
36
|
-
},
|
|
37
|
-
'mfa-recovery': {
|
|
38
|
-
copykey: 'dyn_mfa.recovery_view.helper.title',
|
|
39
|
-
heading: t('dyn_mfa.recovery_view.helper.title'),
|
|
40
|
-
},
|
|
41
|
-
'mfa-secure-device': {
|
|
42
|
-
copykey: 'dyn_mfa.secure_device_view.helper.title',
|
|
43
|
-
heading: t('dyn_mfa.secure_device_view.helper.title'),
|
|
44
|
-
},
|
|
45
|
-
'mfa-verification': {
|
|
46
|
-
copykey: 'dyn_mfa.otp_verification_view.title',
|
|
47
|
-
heading: t('dyn_mfa.otp_verification_view.title'),
|
|
48
|
-
},
|
|
49
33
|
'passkey-intro': {
|
|
50
34
|
copykey: 'dyn_passkey_intro.helper.title',
|
|
51
35
|
heading: t('dyn_passkey_intro.helper.title'),
|
|
@@ -29,7 +29,6 @@ require('../../../config/ApiEndpoint.cjs');
|
|
|
29
29
|
var embeddedWallets = require('../../../data/api/embeddedWallets/embeddedWallets.cjs');
|
|
30
30
|
require('@dynamic-labs/store');
|
|
31
31
|
require('../../../locale/locale.cjs');
|
|
32
|
-
var updateJWTAndCreateUserProfile = require('../../functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs');
|
|
33
32
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
34
33
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
35
34
|
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -81,7 +80,7 @@ require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCa
|
|
|
81
80
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
82
81
|
|
|
83
82
|
const useEmbeddedWalletPassword = () => {
|
|
84
|
-
const { primaryWallet, setShowAuthFlow, environmentId
|
|
83
|
+
const { primaryWallet, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
85
84
|
const { setView } = ViewContext.useViewContext();
|
|
86
85
|
const createPassword = React.useCallback((isClaim, isSignUp) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
87
86
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: false });
|
|
@@ -113,19 +112,12 @@ const useEmbeddedWalletPassword = () => {
|
|
|
113
112
|
logger.logger.error('Error updating jwt after claiming wallet');
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
116
|
-
try {
|
|
117
|
-
const user = updateJWTAndCreateUserProfile.updateJWTAndCreateUserProfile(refreshedToken.jwt, refreshedToken.minifiedJwt);
|
|
118
|
-
setUser(user);
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
logger.logger.error('Error updating jwt after claiming wallet', error);
|
|
122
|
-
}
|
|
123
115
|
}
|
|
124
116
|
catch (error) {
|
|
125
117
|
logger.logger.error('Error claiming wallet', error);
|
|
126
118
|
throw new Error('Error claiming wallet');
|
|
127
119
|
}
|
|
128
|
-
}), [environmentId, primaryWallet
|
|
120
|
+
}), [environmentId, primaryWallet]);
|
|
129
121
|
return {
|
|
130
122
|
claimWallet,
|
|
131
123
|
createPassword,
|
|
@@ -25,7 +25,6 @@ import '../../../config/ApiEndpoint.js';
|
|
|
25
25
|
import { claimEmbeddedWallet } from '../../../data/api/embeddedWallets/embeddedWallets.js';
|
|
26
26
|
import '@dynamic-labs/store';
|
|
27
27
|
import '../../../locale/locale.js';
|
|
28
|
-
import { updateJWTAndCreateUserProfile } from '../../functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js';
|
|
29
28
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
30
29
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
31
30
|
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -77,7 +76,7 @@ import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCar
|
|
|
77
76
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
78
77
|
|
|
79
78
|
const useEmbeddedWalletPassword = () => {
|
|
80
|
-
const { primaryWallet, setShowAuthFlow, environmentId
|
|
79
|
+
const { primaryWallet, setShowAuthFlow, environmentId } = useInternalDynamicContext();
|
|
81
80
|
const { setView } = useViewContext();
|
|
82
81
|
const createPassword = useCallback((isClaim, isSignUp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
82
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: false });
|
|
@@ -109,19 +108,12 @@ const useEmbeddedWalletPassword = () => {
|
|
|
109
108
|
logger.error('Error updating jwt after claiming wallet');
|
|
110
109
|
return;
|
|
111
110
|
}
|
|
112
|
-
try {
|
|
113
|
-
const user = updateJWTAndCreateUserProfile(refreshedToken.jwt, refreshedToken.minifiedJwt);
|
|
114
|
-
setUser(user);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
logger.error('Error updating jwt after claiming wallet', error);
|
|
118
|
-
}
|
|
119
111
|
}
|
|
120
112
|
catch (error) {
|
|
121
113
|
logger.error('Error claiming wallet', error);
|
|
122
114
|
throw new Error('Error claiming wallet');
|
|
123
115
|
}
|
|
124
|
-
}), [environmentId, primaryWallet
|
|
116
|
+
}), [environmentId, primaryWallet]);
|
|
125
117
|
return {
|
|
126
118
|
claimWallet,
|
|
127
119
|
createPassword,
|
|
@@ -370,12 +370,12 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
370
370
|
});
|
|
371
371
|
const connectWithFarcaster = (authMode_1, _g) => _tslib.__awaiter(void 0, [authMode_1, _g], void 0, function* (authMode, { captchaToken }) {
|
|
372
372
|
const dynamicNonce = consumeNonce();
|
|
373
|
-
const domain =
|
|
373
|
+
const domain = utils.PlatformService.getHost();
|
|
374
374
|
const data = yield farcaster.connect({
|
|
375
375
|
domain,
|
|
376
376
|
nonce: dynamicNonce,
|
|
377
377
|
redirectUrl,
|
|
378
|
-
siweUri:
|
|
378
|
+
siweUri: utils.PlatformService.getOrigin(),
|
|
379
379
|
});
|
|
380
380
|
if (!(data === null || data === void 0 ? void 0 : data.url) || !(data === null || data === void 0 ? void 0 : data.channelToken)) {
|
|
381
381
|
handleError(sdkApiCore.ProviderEnum.Farcaster, types.SocialOAuthErrorCode.GENERAL_ERROR, "Farcaster didn't return a valid url.", { raiseAuthFailure: authMode === 'signin' });
|
|
@@ -366,12 +366,12 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
366
366
|
});
|
|
367
367
|
const connectWithFarcaster = (authMode_1, _g) => __awaiter(void 0, [authMode_1, _g], void 0, function* (authMode, { captchaToken }) {
|
|
368
368
|
const dynamicNonce = consumeNonce();
|
|
369
|
-
const domain =
|
|
369
|
+
const domain = PlatformService.getHost();
|
|
370
370
|
const data = yield connect({
|
|
371
371
|
domain,
|
|
372
372
|
nonce: dynamicNonce,
|
|
373
373
|
redirectUrl,
|
|
374
|
-
siweUri:
|
|
374
|
+
siweUri: PlatformService.getOrigin(),
|
|
375
375
|
});
|
|
376
376
|
if (!(data === null || data === void 0 ? void 0 : data.url) || !(data === null || data === void 0 ? void 0 : data.channelToken)) {
|
|
377
377
|
handleError(ProviderEnum.Farcaster, SocialOAuthErrorCode.GENERAL_ERROR, "Farcaster didn't return a valid url.", { raiseAuthFailure: authMode === 'signin' });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSyncEmbeddedWalletFlow } from './useSyncEmbeddedWalletFlow';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
var useEmbeddedWallet = require('../useEmbeddedWallet/useEmbeddedWallet.cjs');
|
|
10
|
+
require('@dynamic-labs/sdk-api-core');
|
|
11
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
12
|
+
var logger = require('../../../shared/logger.cjs');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
+
require('react/jsx-runtime');
|
|
16
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
|
+
require('@dynamic-labs/wallet-book');
|
|
18
|
+
require('../../constants/colors.cjs');
|
|
19
|
+
require('../../constants/values.cjs');
|
|
20
|
+
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
var useDynamicEvents = require('../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
23
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
24
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('react-international-phone');
|
|
27
|
+
require('viem');
|
|
28
|
+
require('viem/chains');
|
|
29
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
30
|
+
require('@dynamic-labs/store');
|
|
31
|
+
require('../../../locale/locale.cjs');
|
|
32
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
34
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
35
|
+
require('../../../events/dynamicEvents.cjs');
|
|
36
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
37
|
+
require('react-dom');
|
|
38
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
39
|
+
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
40
|
+
require('@dynamic-labs/types');
|
|
41
|
+
var LoadingContext = require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
42
|
+
require('yup');
|
|
43
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
44
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
45
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
46
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
47
|
+
require('@dynamic-labs/rpc-providers');
|
|
48
|
+
require('react-i18next');
|
|
49
|
+
require('../../../components/Alert/Alert.cjs');
|
|
50
|
+
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
51
|
+
require('../../../components/IconButton/IconButton.cjs');
|
|
52
|
+
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
53
|
+
require('../../../components/Input/Input.cjs');
|
|
54
|
+
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
55
|
+
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
56
|
+
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
57
|
+
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
58
|
+
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
59
|
+
require('../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
60
|
+
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
61
|
+
require('../../../components/Popper/Popper/Popper.cjs');
|
|
62
|
+
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
63
|
+
require('react-focus-lock');
|
|
64
|
+
require('qrcode');
|
|
65
|
+
var WalletContext = require('../../../context/WalletContext/WalletContext.cjs');
|
|
66
|
+
require('formik');
|
|
67
|
+
require('../../../views/WalletList/WalletList.cjs');
|
|
68
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
69
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
70
|
+
require('@hcaptcha/react-hcaptcha');
|
|
71
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
72
|
+
require('../../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs');
|
|
73
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
74
|
+
require('../../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
75
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
76
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
77
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
78
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
79
|
+
require('../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
80
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
81
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
82
|
+
|
|
83
|
+
const useSyncEmbeddedWalletFlow = () => {
|
|
84
|
+
const { projectSettings, isProjectSettingsLoading, user, primaryWalletId, walletConnectorOptions, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
85
|
+
const { isLoadingEmbeddedWallet } = WalletContext.useWalletContext();
|
|
86
|
+
const { loading: globalLoading } = LoadingContext.useLoadingContext();
|
|
87
|
+
const { createEmbeddedWallet, shouldAutoCreateEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
88
|
+
const triggeredCreate = React.useRef(false);
|
|
89
|
+
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
90
|
+
triggeredCreate.current = false;
|
|
91
|
+
});
|
|
92
|
+
// this is used to trigger createEmbeddedWallet
|
|
93
|
+
// when user didn't create a passkey after login,
|
|
94
|
+
// we force them to created it before they can use the app
|
|
95
|
+
// ** It must be an useEffect because some of the dependencies are async
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
const createWallet = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
triggeredCreate.current = true;
|
|
99
|
+
try {
|
|
100
|
+
yield createEmbeddedWallet();
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof utils.EmbeddedWalletException) {
|
|
104
|
+
logger.logger.debug('Error creating embedded wallet', error);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
logger.logger.error('Error creating embedded wallet', error);
|
|
108
|
+
}
|
|
109
|
+
setShowAuthFlow(false);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const shouldCreateWallet = shouldAutoCreateEmbeddedWallet();
|
|
113
|
+
if (!shouldCreateWallet ||
|
|
114
|
+
!user ||
|
|
115
|
+
isProjectSettingsLoading ||
|
|
116
|
+
!projectSettings ||
|
|
117
|
+
!walletConnectorOptions.length || // no connectors to use for the embedded wallet
|
|
118
|
+
isLoadingEmbeddedWallet || // already has a wallet
|
|
119
|
+
globalLoading || // this will be true if auth is in progress
|
|
120
|
+
triggeredCreate.current // already triggered
|
|
121
|
+
) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
createWallet();
|
|
125
|
+
}, [
|
|
126
|
+
user,
|
|
127
|
+
isProjectSettingsLoading,
|
|
128
|
+
projectSettings,
|
|
129
|
+
primaryWalletId,
|
|
130
|
+
createEmbeddedWallet,
|
|
131
|
+
isLoadingEmbeddedWallet,
|
|
132
|
+
walletConnectorOptions,
|
|
133
|
+
globalLoading,
|
|
134
|
+
shouldAutoCreateEmbeddedWallet,
|
|
135
|
+
setShowAuthFlow,
|
|
136
|
+
]);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
exports.useSyncEmbeddedWalletFlow = useSyncEmbeddedWalletFlow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSyncEmbeddedWalletFlow: () => void;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import { EmbeddedWalletException } from '@dynamic-labs/utils';
|
|
5
|
+
import { useEmbeddedWallet } from '../useEmbeddedWallet/useEmbeddedWallet.js';
|
|
6
|
+
import '@dynamic-labs/sdk-api-core';
|
|
7
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
8
|
+
import { logger } from '../../../shared/logger.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import 'react/jsx-runtime';
|
|
12
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '../../constants/colors.js';
|
|
15
|
+
import '../../constants/values.js';
|
|
16
|
+
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import { useInternalDynamicEvents } from '../events/useDynamicEvents/useDynamicEvents.js';
|
|
19
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import 'react-international-phone';
|
|
23
|
+
import 'viem';
|
|
24
|
+
import 'viem/chains';
|
|
25
|
+
import '../../../config/ApiEndpoint.js';
|
|
26
|
+
import '@dynamic-labs/store';
|
|
27
|
+
import '../../../locale/locale.js';
|
|
28
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
29
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
30
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
31
|
+
import '../../../events/dynamicEvents.js';
|
|
32
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
33
|
+
import 'react-dom';
|
|
34
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
35
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
36
|
+
import '@dynamic-labs/types';
|
|
37
|
+
import { useLoadingContext } from '../../../context/LoadingContext/LoadingContext.js';
|
|
38
|
+
import 'yup';
|
|
39
|
+
import '../../../context/MockContext/MockContext.js';
|
|
40
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
41
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
42
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
43
|
+
import '@dynamic-labs/rpc-providers';
|
|
44
|
+
import 'react-i18next';
|
|
45
|
+
import '../../../components/Alert/Alert.js';
|
|
46
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
47
|
+
import '../../../components/IconButton/IconButton.js';
|
|
48
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
49
|
+
import '../../../components/Input/Input.js';
|
|
50
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
51
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
52
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
53
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
54
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
55
|
+
import '../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
56
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
57
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
58
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
59
|
+
import 'react-focus-lock';
|
|
60
|
+
import 'qrcode';
|
|
61
|
+
import { useWalletContext } from '../../../context/WalletContext/WalletContext.js';
|
|
62
|
+
import 'formik';
|
|
63
|
+
import '../../../views/WalletList/WalletList.js';
|
|
64
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
65
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
66
|
+
import '@hcaptcha/react-hcaptcha';
|
|
67
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
68
|
+
import '../../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js';
|
|
69
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
70
|
+
import '../../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
71
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
72
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
73
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
74
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
75
|
+
import '../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
76
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
77
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
78
|
+
|
|
79
|
+
const useSyncEmbeddedWalletFlow = () => {
|
|
80
|
+
const { projectSettings, isProjectSettingsLoading, user, primaryWalletId, walletConnectorOptions, setShowAuthFlow, } = useInternalDynamicContext();
|
|
81
|
+
const { isLoadingEmbeddedWallet } = useWalletContext();
|
|
82
|
+
const { loading: globalLoading } = useLoadingContext();
|
|
83
|
+
const { createEmbeddedWallet, shouldAutoCreateEmbeddedWallet } = useEmbeddedWallet();
|
|
84
|
+
const triggeredCreate = useRef(false);
|
|
85
|
+
useInternalDynamicEvents('logout', () => {
|
|
86
|
+
triggeredCreate.current = false;
|
|
87
|
+
});
|
|
88
|
+
// this is used to trigger createEmbeddedWallet
|
|
89
|
+
// when user didn't create a passkey after login,
|
|
90
|
+
// we force them to created it before they can use the app
|
|
91
|
+
// ** It must be an useEffect because some of the dependencies are async
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const createWallet = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
triggeredCreate.current = true;
|
|
95
|
+
try {
|
|
96
|
+
yield createEmbeddedWallet();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof EmbeddedWalletException) {
|
|
100
|
+
logger.debug('Error creating embedded wallet', error);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
logger.error('Error creating embedded wallet', error);
|
|
104
|
+
}
|
|
105
|
+
setShowAuthFlow(false);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const shouldCreateWallet = shouldAutoCreateEmbeddedWallet();
|
|
109
|
+
if (!shouldCreateWallet ||
|
|
110
|
+
!user ||
|
|
111
|
+
isProjectSettingsLoading ||
|
|
112
|
+
!projectSettings ||
|
|
113
|
+
!walletConnectorOptions.length || // no connectors to use for the embedded wallet
|
|
114
|
+
isLoadingEmbeddedWallet || // already has a wallet
|
|
115
|
+
globalLoading || // this will be true if auth is in progress
|
|
116
|
+
triggeredCreate.current // already triggered
|
|
117
|
+
) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
createWallet();
|
|
121
|
+
}, [
|
|
122
|
+
user,
|
|
123
|
+
isProjectSettingsLoading,
|
|
124
|
+
projectSettings,
|
|
125
|
+
primaryWalletId,
|
|
126
|
+
createEmbeddedWallet,
|
|
127
|
+
isLoadingEmbeddedWallet,
|
|
128
|
+
walletConnectorOptions,
|
|
129
|
+
globalLoading,
|
|
130
|
+
shouldAutoCreateEmbeddedWallet,
|
|
131
|
+
setShowAuthFlow,
|
|
132
|
+
]);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { useSyncEmbeddedWalletFlow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useWalletsConnectionState } from './useWalletsConnectionState';
|
|
@@ -4,11 +4,93 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
9
|
+
require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('../../shared/logger.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
require('../../utils/constants/colors.cjs');
|
|
16
|
+
require('../../utils/constants/values.cjs');
|
|
17
|
+
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('@dynamic-labs/utils');
|
|
19
|
+
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
|
+
require('viem');
|
|
27
|
+
require('viem/chains');
|
|
28
|
+
require('../../config/ApiEndpoint.cjs');
|
|
29
|
+
require('@dynamic-labs/store');
|
|
30
|
+
require('../../locale/locale.cjs');
|
|
31
|
+
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
32
|
+
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
33
|
+
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
34
|
+
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
35
|
+
require('react-dom');
|
|
36
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
37
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
38
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
39
|
+
require('@dynamic-labs/types');
|
|
40
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
41
|
+
require('yup');
|
|
42
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
43
|
+
require('../../views/CollectUserDataView/useFields.cjs');
|
|
44
|
+
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
45
|
+
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
46
|
+
require('@dynamic-labs/rpc-providers');
|
|
47
|
+
require('react-i18next');
|
|
48
|
+
require('../../components/Alert/Alert.cjs');
|
|
49
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
50
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
51
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
52
|
+
require('../../components/Input/Input.cjs');
|
|
53
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
54
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
55
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
56
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
57
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
58
|
+
require('../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
59
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
60
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
61
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
62
|
+
require('react-focus-lock');
|
|
63
|
+
require('qrcode');
|
|
64
|
+
require('formik');
|
|
65
|
+
require('../../views/WalletList/WalletList.cjs');
|
|
66
|
+
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
67
|
+
require('../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
68
|
+
require('@hcaptcha/react-hcaptcha');
|
|
69
|
+
require('../../context/FooterAnimationContext/index.cjs');
|
|
70
|
+
require('../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs');
|
|
71
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
72
|
+
require('../../context/MfaSettingsContext/MfaSettingsContext.cjs');
|
|
73
|
+
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
74
|
+
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
75
|
+
require('../DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
76
|
+
require('../DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
77
|
+
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
78
|
+
require('../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
79
|
+
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
7
80
|
var DynamicEmbeddedAuthFlow = require('./DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs');
|
|
8
81
|
var DynamicEmbeddedUserProfile = require('./DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs');
|
|
9
82
|
|
|
10
|
-
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) =>
|
|
11
|
-
|
|
12
|
-
|
|
83
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => {
|
|
84
|
+
const { setDynamicWidgetHasLoaded } = useInternalDynamicContext.useInternalDynamicContext();
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
setDynamicWidgetHasLoaded(true);
|
|
87
|
+
return () => {
|
|
88
|
+
setDynamicWidgetHasLoaded(false);
|
|
89
|
+
};
|
|
90
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
91
|
+
return (
|
|
92
|
+
// Only one of these 2 show at any given time, due these components' own definitions
|
|
93
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicEmbeddedAuthFlow.DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsxRuntime.jsx(DynamicEmbeddedUserProfile.DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
94
|
+
};
|
|
13
95
|
|
|
14
96
|
exports.DynamicEmbeddedWidget = DynamicEmbeddedWidget;
|
|
@@ -1,10 +1,92 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
5
|
+
import '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '../../shared/logger.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
import '../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '../../utils/constants/colors.js';
|
|
12
|
+
import '../../utils/constants/values.js';
|
|
13
|
+
import '../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../shared/consts/index.js';
|
|
16
|
+
import '../../events/dynamicEvents.js';
|
|
17
|
+
import '../../../../_virtual/_tslib.js';
|
|
18
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
+
import '../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import 'react-international-phone';
|
|
22
|
+
import 'viem';
|
|
23
|
+
import 'viem/chains';
|
|
24
|
+
import '../../config/ApiEndpoint.js';
|
|
25
|
+
import '@dynamic-labs/store';
|
|
26
|
+
import '../../locale/locale.js';
|
|
27
|
+
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
28
|
+
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
29
|
+
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
30
|
+
import '../../context/VerificationContext/VerificationContext.js';
|
|
31
|
+
import 'react-dom';
|
|
32
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
33
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
34
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
35
|
+
import '@dynamic-labs/types';
|
|
36
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
37
|
+
import 'yup';
|
|
38
|
+
import '../../context/MockContext/MockContext.js';
|
|
39
|
+
import '../../views/CollectUserDataView/useFields.js';
|
|
40
|
+
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
41
|
+
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
42
|
+
import '@dynamic-labs/rpc-providers';
|
|
43
|
+
import 'react-i18next';
|
|
44
|
+
import '../../components/Alert/Alert.js';
|
|
45
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
46
|
+
import '../../components/IconButton/IconButton.js';
|
|
47
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
48
|
+
import '../../components/Input/Input.js';
|
|
49
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
50
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
51
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
52
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
53
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
54
|
+
import '../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
55
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
56
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
57
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
58
|
+
import 'react-focus-lock';
|
|
59
|
+
import 'qrcode';
|
|
60
|
+
import 'formik';
|
|
61
|
+
import '../../views/WalletList/WalletList.js';
|
|
62
|
+
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
63
|
+
import '../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
64
|
+
import '@hcaptcha/react-hcaptcha';
|
|
65
|
+
import '../../context/FooterAnimationContext/index.js';
|
|
66
|
+
import '../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js';
|
|
67
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
68
|
+
import '../../context/MfaSettingsContext/MfaSettingsContext.js';
|
|
69
|
+
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
70
|
+
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
71
|
+
import '../DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
72
|
+
import '../DynamicWidget/context/DynamicWidgetContext.js';
|
|
73
|
+
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
74
|
+
import '../DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
75
|
+
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
3
76
|
import { DynamicEmbeddedAuthFlow } from './DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js';
|
|
4
77
|
import { DynamicEmbeddedUserProfile } from './DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js';
|
|
5
78
|
|
|
6
|
-
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) =>
|
|
7
|
-
|
|
8
|
-
|
|
79
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => {
|
|
80
|
+
const { setDynamicWidgetHasLoaded } = useInternalDynamicContext();
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
setDynamicWidgetHasLoaded(true);
|
|
83
|
+
return () => {
|
|
84
|
+
setDynamicWidgetHasLoaded(false);
|
|
85
|
+
};
|
|
86
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
87
|
+
return (
|
|
88
|
+
// Only one of these 2 show at any given time, due these components' own definitions
|
|
89
|
+
jsxs(Fragment, { children: [jsx(DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsx(DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
90
|
+
};
|
|
9
91
|
|
|
10
92
|
export { DynamicEmbeddedWidget };
|