@dynamic-labs/sdk-react-core 2.1.0-alpha.27 → 2.1.0-alpha.29
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 +27 -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/store/hooks/useProjectSettings/useProjectSettings.cjs +5 -2
- package/src/lib/store/hooks/useProjectSettings/useProjectSettings.js +5 -2
- package/src/lib/store/utils/clearExpiredData/clearExpiredData.cjs +23 -3
- package/src/lib/store/utils/clearExpiredData/clearExpiredData.js +23 -3
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +2 -2
- package/src/lib/utils/constants/localStorage.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.js +2 -2
- 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 -2
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.cjs +14 -6
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.d.ts +1 -1
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.js +14 -6
- 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/getProjectSettingsFromLs/getProjectSettingsFromLs.cjs +0 -28
- package/src/lib/utils/functions/getProjectSettingsFromLs/getProjectSettingsFromLs.d.ts +0 -2
- package/src/lib/utils/functions/getProjectSettingsFromLs/getProjectSettingsFromLs.js +0 -24
- package/src/lib/utils/functions/getProjectSettingsFromLs/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
|
@@ -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 };
|
|
@@ -84,7 +84,7 @@ var DynamicNav = require('./components/DynamicNav/DynamicNav.cjs');
|
|
|
84
84
|
var DynamicUserProfile = require('./components/DynamicUserProfile/DynamicUserProfile.cjs');
|
|
85
85
|
|
|
86
86
|
const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', innerButtonComponent, variant = 'modal', }) => {
|
|
87
|
-
const { showAuthFlow, setShowDynamicUserProfile } = useInternalDynamicContext.useInternalDynamicContext();
|
|
87
|
+
const { showAuthFlow, setShowDynamicUserProfile, setDynamicWidgetHasLoaded } = useInternalDynamicContext.useInternalDynamicContext();
|
|
88
88
|
const { widgetRef, inlineControlsRef } = DynamicWidgetContext.useWidgetContext();
|
|
89
89
|
const { t } = reactI18next.useTranslation();
|
|
90
90
|
if (!innerButtonComponent) {
|
|
@@ -101,6 +101,12 @@ const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', in
|
|
|
101
101
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
102
102
|
index.useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
103
103
|
const showDynamicConnectButton = !useIsLoggedIn.useIsLoggedIn();
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
setDynamicWidgetHasLoaded(true);
|
|
106
|
+
return () => {
|
|
107
|
+
setDynamicWidgetHasLoaded(false);
|
|
108
|
+
};
|
|
109
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
104
110
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'dynamic-widget__container', id: 'dynamic-widget', children: showDynamicConnectButton ? (jsxRuntime.jsx(DynamicConnectButton.DynamicConnectButton, { buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName, copykey: 'dyn_widget.connect', children: innerButtonComponent })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicNav.DynamicNav, {}), jsxRuntime.jsx(DynamicUserProfile.DynamicUserProfile, { variant: variant })] })) }));
|
|
105
111
|
};
|
|
106
112
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import '../../events/dynamicEvents.js';
|
|
6
6
|
import '../../../../_virtual/_tslib.js';
|
|
@@ -80,7 +80,7 @@ import { DynamicNav } from './components/DynamicNav/DynamicNav.js';
|
|
|
80
80
|
import { DynamicUserProfile } from './components/DynamicUserProfile/DynamicUserProfile.js';
|
|
81
81
|
|
|
82
82
|
const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', innerButtonComponent, variant = 'modal', }) => {
|
|
83
|
-
const { showAuthFlow, setShowDynamicUserProfile } = useInternalDynamicContext();
|
|
83
|
+
const { showAuthFlow, setShowDynamicUserProfile, setDynamicWidgetHasLoaded } = useInternalDynamicContext();
|
|
84
84
|
const { widgetRef, inlineControlsRef } = useWidgetContext();
|
|
85
85
|
const { t } = useTranslation();
|
|
86
86
|
if (!innerButtonComponent) {
|
|
@@ -97,6 +97,12 @@ const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', in
|
|
|
97
97
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
98
98
|
useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
99
99
|
const showDynamicConnectButton = !useIsLoggedIn();
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setDynamicWidgetHasLoaded(true);
|
|
102
|
+
return () => {
|
|
103
|
+
setDynamicWidgetHasLoaded(false);
|
|
104
|
+
};
|
|
105
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
100
106
|
return (jsx(ShadowDOM, { className: 'dynamic-widget__container', id: 'dynamic-widget', children: showDynamicConnectButton ? (jsx(DynamicConnectButton, { buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName, copykey: 'dyn_widget.connect', children: innerButtonComponent })) : (jsxs(Fragment, { children: [jsx(DynamicNav, {}), jsx(DynamicUserProfile, { variant: variant })] })) }));
|
|
101
107
|
};
|
|
102
108
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SyncEmbeddedWalletAuthFlow: () => null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SyncEmbeddedWalletAuthFlow } from './SyncEmbeddedWalletAuthFlow';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
|
-
require('../../../shared/logger.cjs');
|
|
8
|
-
require('@dynamic-labs/iconic');
|
|
9
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
require('react/jsx-runtime');
|
|
11
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
-
require('react');
|
|
13
|
-
require('@dynamic-labs/wallet-book');
|
|
14
|
-
var localStorage$1 = require('../../constants/localStorage.cjs');
|
|
15
|
-
require('../../constants/colors.cjs');
|
|
16
|
-
require('../../constants/values.cjs');
|
|
17
|
-
var localStorage = require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
-
require('@dynamic-labs/utils');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
20
|
-
|
|
21
|
-
const getProjectSettingsFromLs = () => {
|
|
22
|
-
const value = localStorage.LocalStorage.getFromLS(localStorage$1.PROJECT_SETTINGS_STORAGE_KEY, true);
|
|
23
|
-
if (!value)
|
|
24
|
-
return undefined;
|
|
25
|
-
return sdkApiCore.ProjectSettingsFromJSON(value.settings);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
exports.getProjectSettingsFromLs = getProjectSettingsFromLs;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { ProjectSettingsFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import '../../../shared/logger.js';
|
|
4
|
-
import '@dynamic-labs/iconic';
|
|
5
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import 'react/jsx-runtime';
|
|
7
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '@dynamic-labs/wallet-book';
|
|
10
|
-
import { PROJECT_SETTINGS_STORAGE_KEY } from '../../constants/localStorage.js';
|
|
11
|
-
import '../../constants/colors.js';
|
|
12
|
-
import '../../constants/values.js';
|
|
13
|
-
import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
-
import '@dynamic-labs/utils';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
|
-
|
|
17
|
-
const getProjectSettingsFromLs = () => {
|
|
18
|
-
const value = LocalStorage.getFromLS(PROJECT_SETTINGS_STORAGE_KEY, true);
|
|
19
|
-
if (!value)
|
|
20
|
-
return undefined;
|
|
21
|
-
return ProjectSettingsFromJSON(value.settings);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { getProjectSettingsFromLs };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getProjectSettingsFromLs } from './getProjectSettingsFromLs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { updateJWTAndCreateUserProfile } from './updateJWTAndCreateUserProfile';
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var utils = require('@dynamic-labs/utils');
|
|
7
|
-
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
8
|
-
var createUserProfile = require('../createUserProfile/createUserProfile.cjs');
|
|
9
|
-
var index = require('../storeAuthToken/index.cjs');
|
|
10
|
-
|
|
11
|
-
const updateJWTAndCreateUserProfile = (jwt, minJwt) => {
|
|
12
|
-
const decodedJWT = decodeJwt.decodeJwt(jwt);
|
|
13
|
-
if (!jwt || !decodedJWT || !minJwt) {
|
|
14
|
-
throw new utils.DynamicError('Invalid session');
|
|
15
|
-
}
|
|
16
|
-
index.storeAuthToken(jwt, minJwt);
|
|
17
|
-
return createUserProfile.createUserProfile(decodedJWT);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.updateJWTAndCreateUserProfile = updateJWTAndCreateUserProfile;
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const updateJWTAndCreateUserProfile: (jwt: string | undefined, minJwt: string | undefined) => import("dist/packages/types/src").UserProfile;
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
|
-
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
4
|
-
import { createUserProfile } from '../createUserProfile/createUserProfile.js';
|
|
5
|
-
import { storeAuthToken } from '../storeAuthToken/index.js';
|
|
6
|
-
|
|
7
|
-
const updateJWTAndCreateUserProfile = (jwt, minJwt) => {
|
|
8
|
-
const decodedJWT = decodeJwt(jwt);
|
|
9
|
-
if (!jwt || !decodedJWT || !minJwt) {
|
|
10
|
-
throw new DynamicError('Invalid session');
|
|
11
|
-
}
|
|
12
|
-
storeAuthToken(jwt, minJwt);
|
|
13
|
-
return createUserProfile(decodedJWT);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { updateJWTAndCreateUserProfile };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useCreateUserProfileByJWTCallback';
|