@dynamic-labs/sdk-react-core 3.0.0-alpha.5 → 3.0.0-alpha.6
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 +17 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +11 -11
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +2 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +2 -1
- package/src/lib/components/QRCode/QRCode.d.ts +15 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +2 -2
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +3 -67
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +3 -67
- package/src/lib/data/api/externalAuth/externalAuth.d.ts +5 -0
- package/src/lib/data/api/externalAuth/index.d.ts +1 -0
- package/src/lib/data/api/index.d.ts +1 -0
- package/src/lib/events/auth.d.ts +1 -0
- package/src/lib/events/embeddedWallet.d.ts +1 -1
- package/src/lib/locale/en/translation.cjs +4 -4
- package/src/lib/locale/en/translation.d.ts +2 -2
- package/src/lib/locale/en/translation.js +4 -4
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +1 -3
- 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 +2 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +2 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +6 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +6 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +1 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +1 -2
- package/src/lib/utils/hooks/useExternalAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.d.ts +9 -0
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +1 -6
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +1 -6
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -1
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +1 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +4 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +4 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +8 -5
- package/src/lib/views/EmailVerification/EmailVerification.js +8 -5
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2024-06-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* implement useExternalAuth hook to signin using external jwt auth ([#6039](https://github.com/dynamic-labs/DynamicAuth/issues/6039)) ([ba90908](https://github.com/dynamic-labs/DynamicAuth/commit/ba90908509ec21f708a4a0782a7f94861fc3b484))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* allow sign-in with different ME BTC wallet after initial connection ([a527b46](https://github.com/dynamic-labs/DynamicAuth/commit/a527b464f321b4fc27730f57c3812e996b5ed878))
|
|
13
|
+
* close sign modal when signing in with a wallet when embedded wallet is enabled ([#6013](https://github.com/dynamic-labs/DynamicAuth/issues/6013)) ([0f4f3c8](https://github.com/dynamic-labs/DynamicAuth/commit/0f4f3c83db162f7a1794a3549b60bbad6b03e2c0))
|
|
14
|
+
* custom network without a valid icon should still display its name in network picker ([#6018](https://github.com/dynamic-labs/DynamicAuth/issues/6018)) ([0b10df6](https://github.com/dynamic-labs/DynamicAuth/commit/0b10df68950bfc9b8492443158a6bb030dc1122c))
|
|
15
|
+
* e2e: remove page pause ([#6045](https://github.com/dynamic-labs/DynamicAuth/issues/6045)) ([55bba00](https://github.com/dynamic-labs/DynamicAuth/commit/55bba0034255055d6ae266b1296542f47ed48e2b))
|
|
16
|
+
* more fixes for connect starknet button ([#6046](https://github.com/dynamic-labs/DynamicAuth/issues/6046)) ([0fb570a](https://github.com/dynamic-labs/DynamicAuth/commit/0fb570a44e65f8dd6d4d2bf5edb2ee54985ec9d4))
|
|
17
|
+
* set verified credentials on embedded wallet creation ([#6044](https://github.com/dynamic-labs/DynamicAuth/issues/6044)) ([b52a96d](https://github.com/dynamic-labs/DynamicAuth/commit/b52a96d321e7efdb30dce9cdb3f6f176c24ceb81))
|
|
18
|
+
|
|
2
19
|
## [3.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-06-14)
|
|
3
20
|
|
|
4
21
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "3.0.0-alpha.
|
|
6
|
+
var version = "3.0.0-alpha.6";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.470",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
formik: "2.2.9",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "3.0.0-alpha.
|
|
2
|
+
var version = "3.0.0-alpha.6";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.470",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
formik: "2.2.9",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
7
7
|
"directory": "packages/sdk-react-core"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
10
|
+
"@dynamic-labs/sdk-api-core": "0.0.470",
|
|
11
11
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
12
12
|
"country-list": "2.3.0",
|
|
13
13
|
"formik": "2.2.9",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.6",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.0-alpha.6",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.6",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.6",
|
|
24
|
+
"@dynamic-labs/store": "3.0.0-alpha.6",
|
|
25
|
+
"@dynamic-labs/types": "3.0.0-alpha.6",
|
|
26
|
+
"@dynamic-labs/utils": "3.0.0-alpha.6",
|
|
27
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.6",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.6",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -8,6 +8,7 @@ var utils = require('@dynamic-labs/utils');
|
|
|
8
8
|
require('@dynamic-labs/iconic');
|
|
9
9
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
10
10
|
require('react');
|
|
11
|
+
var error = require('../../../../shared/assets/error.cjs');
|
|
11
12
|
var stroke = require('../../../../shared/assets/stroke.cjs');
|
|
12
13
|
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
13
14
|
require('../../../Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
@@ -112,7 +113,7 @@ const EvmNetworkControl = ({ evmNetworks, className = '', activeClassName = '',
|
|
|
112
113
|
[activeClassName]: isOpen,
|
|
113
114
|
'evm-network-control__container': Boolean(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.supportsNetworkSwitching()),
|
|
114
115
|
'evm-network-control__container--error': !(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name),
|
|
115
|
-
}), children: [(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name)
|
|
116
|
+
}), children: [(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', children: ((_b = currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.iconUrls) === null || _b === void 0 ? void 0 : _b[0]) ? (jsxRuntime.jsx("img", { src: currentEvmNetwork.iconUrls[0], alt: `${currentEvmNetwork.name} icon` })) : (jsxRuntime.jsx(error.ReactComponent, {})) }), showNetworkName && (jsxRuntime.jsx(Typography.Typography, { className: 'evm-network-control__network-name', as: 'span', variant: 'body_small', children: currentEvmNetwork.vanityName || currentEvmNetwork.name }))] })) : (jsxRuntime.jsx(UnsupportedNetwork.UnsupportedNetwork, { showMsg: showNetworkName })), evmNetworks && evmNetworks.length > 1 && (jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'small', className: classNames.classNames('evm-network-control__arrow-icon', {
|
|
116
117
|
'evm-network-control__arrow-icon--active': isOpen,
|
|
117
118
|
}), children: jsxRuntime.jsx(stroke.ReactComponent, {}) }))] }));
|
|
118
119
|
};
|
|
@@ -4,6 +4,7 @@ import { parseChainId } from '@dynamic-labs/utils';
|
|
|
4
4
|
import '@dynamic-labs/iconic';
|
|
5
5
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
6
6
|
import 'react';
|
|
7
|
+
import { ReactComponent as SvgError } from '../../../../shared/assets/error.js';
|
|
7
8
|
import { ReactComponent as SvgStroke } from '../../../../shared/assets/stroke.js';
|
|
8
9
|
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
9
10
|
import '../../../Accordion/components/AccordionItem/AccordionItem.js';
|
|
@@ -108,7 +109,7 @@ const EvmNetworkControl = ({ evmNetworks, className = '', activeClassName = '',
|
|
|
108
109
|
[activeClassName]: isOpen,
|
|
109
110
|
'evm-network-control__container': Boolean(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.supportsNetworkSwitching()),
|
|
110
111
|
'evm-network-control__container--error': !(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name),
|
|
111
|
-
}), children: [(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name)
|
|
112
|
+
}), children: [(currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.name) ? (jsxs(Fragment, { children: [jsx(Icon, { size: 'small', children: ((_b = currentEvmNetwork === null || currentEvmNetwork === void 0 ? void 0 : currentEvmNetwork.iconUrls) === null || _b === void 0 ? void 0 : _b[0]) ? (jsx("img", { src: currentEvmNetwork.iconUrls[0], alt: `${currentEvmNetwork.name} icon` })) : (jsx(SvgError, {})) }), showNetworkName && (jsx(Typography, { className: 'evm-network-control__network-name', as: 'span', variant: 'body_small', children: currentEvmNetwork.vanityName || currentEvmNetwork.name }))] })) : (jsx(UnsupportedNetwork, { showMsg: showNetworkName })), evmNetworks && evmNetworks.length > 1 && (jsx(Icon, { color: 'text-primary', size: 'small', className: classNames('evm-network-control__arrow-icon', {
|
|
112
113
|
'evm-network-control__arrow-icon--active': isOpen,
|
|
113
114
|
}), children: jsx(SvgStroke, {}) }))] }));
|
|
114
115
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { QRCodeErrorCorrectionLevel } from 'qrcode';
|
|
3
|
+
type QRCodeProps = {
|
|
4
|
+
Icon: ReactElement;
|
|
5
|
+
accentColor?: string;
|
|
6
|
+
ecl?: QRCodeErrorCorrectionLevel;
|
|
7
|
+
logoMargin?: number;
|
|
8
|
+
logoSize?: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
value: string;
|
|
11
|
+
walletKey?: string;
|
|
12
|
+
showQrCodeImage?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const QRCode: ({ ecl, Icon, logoMargin, logoSize, size, value, accentColor, walletKey, showQrCodeImage, }: QRCodeProps) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -281,7 +281,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
281
281
|
const { selectedWalletConnector, setSelectedWalletConnectorKey } = useSelectedWalletConnector.useSelectedWalletConnector({ walletConnectorOptions });
|
|
282
282
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
283
283
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = React.useState(null);
|
|
284
|
-
useSetWalletConnectorVerifiedCredentials.useSetWalletConnectorVerifiedCredentials(user, walletConnectorOptions);
|
|
284
|
+
useSetWalletConnectorVerifiedCredentials.useSetWalletConnectorVerifiedCredentials(user !== null && user !== void 0 ? user : unauthenticatedUser, walletConnectorOptions);
|
|
285
285
|
useSetWalletConnectorFetchers.useSetWalletConnectorFetchers(walletConnectorOptions, environmentId);
|
|
286
286
|
const { didConnectedStateLoad, primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors.useWalletConnectors({
|
|
287
287
|
authMode,
|
|
@@ -277,7 +277,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
277
277
|
const { selectedWalletConnector, setSelectedWalletConnectorKey } = useSelectedWalletConnector({ walletConnectorOptions });
|
|
278
278
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
279
279
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = useState(null);
|
|
280
|
-
useSetWalletConnectorVerifiedCredentials(user, walletConnectorOptions);
|
|
280
|
+
useSetWalletConnectorVerifiedCredentials(user !== null && user !== void 0 ? user : unauthenticatedUser, walletConnectorOptions);
|
|
281
281
|
useSetWalletConnectorFetchers(walletConnectorOptions, environmentId);
|
|
282
282
|
const { didConnectedStateLoad, primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors({
|
|
283
283
|
authMode,
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs
CHANGED
|
@@ -111,9 +111,9 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
111
111
|
var _a;
|
|
112
112
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
113
113
|
});
|
|
114
|
-
useDynamicEvents.useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential,
|
|
114
|
+
useDynamicEvents.useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, user) => {
|
|
115
115
|
var _a;
|
|
116
|
-
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential,
|
|
116
|
+
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, user);
|
|
117
117
|
});
|
|
118
118
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
119
119
|
var _a;
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js
CHANGED
|
@@ -107,9 +107,9 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
107
107
|
var _a;
|
|
108
108
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
109
109
|
});
|
|
110
|
-
useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential,
|
|
110
|
+
useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, user) => {
|
|
111
111
|
var _a;
|
|
112
|
-
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential,
|
|
112
|
+
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, user);
|
|
113
113
|
});
|
|
114
114
|
useInternalDynamicEvents('logout', () => {
|
|
115
115
|
var _a;
|
|
@@ -17,78 +17,16 @@ require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
17
17
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
18
18
|
require('@dynamic-labs/utils');
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
|
-
require('../../../../../_virtual/_tslib.cjs');
|
|
21
|
-
require('@dynamic-labs/multi-wallet');
|
|
22
|
-
var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
23
|
-
var getMinAuthToken = require('../../../utils/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
24
|
-
require('react-international-phone');
|
|
25
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
26
|
-
require('@dynamic-labs/store');
|
|
27
|
-
require('../../../locale/locale.cjs');
|
|
28
|
-
require('../../../events/dynamicEvents.cjs');
|
|
29
|
-
require('../DynamicContext.cjs');
|
|
30
|
-
require('../../CaptchaContext/CaptchaContext.cjs');
|
|
31
|
-
require('../../ErrorContext/ErrorContext.cjs');
|
|
32
|
-
require('../../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
|
-
require('../../AccountExistsContext/AccountExistsContext.cjs');
|
|
34
|
-
require('../../UserWalletsContext/UserWalletsContext.cjs');
|
|
35
|
-
require('../../VerificationContext/VerificationContext.cjs');
|
|
36
|
-
require('react-dom');
|
|
37
|
-
require('../../WalletContext/WalletContext.cjs');
|
|
38
|
-
require('../../ThemeContext/ThemeContext.cjs');
|
|
39
|
-
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
40
|
-
require('@dynamic-labs/types');
|
|
41
|
-
require('../../LoadingContext/LoadingContext.cjs');
|
|
42
|
-
require('yup');
|
|
43
|
-
require('../../MockContext/MockContext.cjs');
|
|
44
|
-
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
45
|
-
require('../../FieldsStateContext/FieldsStateContext.cjs');
|
|
46
|
-
require('../../UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
47
|
-
require('@dynamic-labs/rpc-providers');
|
|
48
|
-
require('react-i18next');
|
|
49
|
-
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
50
|
-
require('../../../components/Alert/Alert.cjs');
|
|
51
|
-
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
52
|
-
require('../../../components/IconButton/IconButton.cjs');
|
|
53
|
-
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
54
|
-
require('../../../components/Input/Input.cjs');
|
|
55
|
-
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
56
|
-
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
57
|
-
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
58
|
-
require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
59
|
-
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
60
|
-
require('../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
61
|
-
require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
62
|
-
require('../../../components/Popper/Popper/Popper.cjs');
|
|
63
|
-
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
64
|
-
require('react-focus-lock');
|
|
65
|
-
require('qrcode');
|
|
66
|
-
require('formik');
|
|
67
|
-
require('../../../views/WalletList/WalletList.cjs');
|
|
68
|
-
require('../../SocialRedirectContext/SocialRedirectContext.cjs');
|
|
69
|
-
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
70
|
-
require('@hcaptcha/react-hcaptcha');
|
|
71
|
-
require('../../FooterAnimationContext/index.cjs');
|
|
72
|
-
require('../../WalletGroupContext/WalletGroupContext.cjs');
|
|
73
|
-
require('../../MfaSettingsContext/MfaSettingsContext.cjs');
|
|
74
|
-
require('../../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
75
|
-
require('../../PasskeyContext/PasskeyContext.cjs');
|
|
76
|
-
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
77
|
-
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
78
|
-
require('../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
79
|
-
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
80
20
|
|
|
81
21
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
82
22
|
const [callbackQueue, setCallbackQueue] = React.useState([]);
|
|
83
|
-
const handleNextCallback = React.useCallback((next,
|
|
23
|
+
const handleNextCallback = React.useCallback((next, user) => {
|
|
84
24
|
switch (next === null || next === void 0 ? void 0 : next.callback) {
|
|
85
25
|
case 'authSuccess': {
|
|
86
26
|
try {
|
|
87
27
|
onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess({
|
|
88
|
-
authToken,
|
|
89
28
|
handleLogOut,
|
|
90
29
|
isAuthenticated,
|
|
91
|
-
minAuthToken,
|
|
92
30
|
primaryWallet,
|
|
93
31
|
user,
|
|
94
32
|
});
|
|
@@ -120,16 +58,14 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
120
58
|
React.useEffect(() => {
|
|
121
59
|
if (!callbackQueue.length || !user)
|
|
122
60
|
return;
|
|
123
|
-
const authToken = getAuthToken.getAuthToken();
|
|
124
|
-
const minAuthToken = getMinAuthToken.getMinAuthToken();
|
|
125
61
|
// checks if user logged in with a wallet, so we need to wait
|
|
126
62
|
// for the primary wallet state to be set
|
|
127
63
|
// if user logged in with email without embedded wallet, then
|
|
128
64
|
// there is no wallet so we can go ahead and run the callback
|
|
129
|
-
if (
|
|
65
|
+
if (user.isAuthenticatedWithAWallet && !primaryWallet) {
|
|
130
66
|
return;
|
|
131
67
|
}
|
|
132
|
-
handleNextCallback(callbackQueue[0],
|
|
68
|
+
handleNextCallback(callbackQueue[0], user);
|
|
133
69
|
setCallbackQueue((prev) => {
|
|
134
70
|
const [resolvedCallback, ...updatedQueue] = prev;
|
|
135
71
|
if (resolvedCallback) {
|
|
@@ -13,78 +13,16 @@ import '../../../shared/utils/classes/storage/localStorage.js';
|
|
|
13
13
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
14
14
|
import '@dynamic-labs/utils';
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
|
-
import '../../../../../_virtual/_tslib.js';
|
|
17
|
-
import '@dynamic-labs/multi-wallet';
|
|
18
|
-
import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
|
|
19
|
-
import { getMinAuthToken } from '../../../utils/functions/getMinAuthToken/getMinAuthToken.js';
|
|
20
|
-
import 'react-international-phone';
|
|
21
|
-
import '../../../config/ApiEndpoint.js';
|
|
22
|
-
import '@dynamic-labs/store';
|
|
23
|
-
import '../../../locale/locale.js';
|
|
24
|
-
import '../../../events/dynamicEvents.js';
|
|
25
|
-
import '../DynamicContext.js';
|
|
26
|
-
import '../../CaptchaContext/CaptchaContext.js';
|
|
27
|
-
import '../../ErrorContext/ErrorContext.js';
|
|
28
|
-
import '../../AccessDeniedContext/AccessDeniedContext.js';
|
|
29
|
-
import '../../AccountExistsContext/AccountExistsContext.js';
|
|
30
|
-
import '../../UserWalletsContext/UserWalletsContext.js';
|
|
31
|
-
import '../../VerificationContext/VerificationContext.js';
|
|
32
|
-
import 'react-dom';
|
|
33
|
-
import '../../WalletContext/WalletContext.js';
|
|
34
|
-
import '../../ThemeContext/ThemeContext.js';
|
|
35
|
-
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
36
|
-
import '@dynamic-labs/types';
|
|
37
|
-
import '../../LoadingContext/LoadingContext.js';
|
|
38
|
-
import 'yup';
|
|
39
|
-
import '../../MockContext/MockContext.js';
|
|
40
|
-
import '../../../views/CollectUserDataView/useFields.js';
|
|
41
|
-
import '../../FieldsStateContext/FieldsStateContext.js';
|
|
42
|
-
import '../../UserFieldEditorContext/UserFieldEditorContext.js';
|
|
43
|
-
import '@dynamic-labs/rpc-providers';
|
|
44
|
-
import 'react-i18next';
|
|
45
|
-
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
46
|
-
import '../../../components/Alert/Alert.js';
|
|
47
|
-
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
48
|
-
import '../../../components/IconButton/IconButton.js';
|
|
49
|
-
import '../../../components/InlineWidget/InlineWidget.js';
|
|
50
|
-
import '../../../components/Input/Input.js';
|
|
51
|
-
import '../../../components/IsBrowser/IsBrowser.js';
|
|
52
|
-
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
53
|
-
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
54
|
-
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
55
|
-
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
56
|
-
import '../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
57
|
-
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
58
|
-
import '../../../components/Popper/Popper/Popper.js';
|
|
59
|
-
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
60
|
-
import 'react-focus-lock';
|
|
61
|
-
import 'qrcode';
|
|
62
|
-
import 'formik';
|
|
63
|
-
import '../../../views/WalletList/WalletList.js';
|
|
64
|
-
import '../../SocialRedirectContext/SocialRedirectContext.js';
|
|
65
|
-
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
66
|
-
import '@hcaptcha/react-hcaptcha';
|
|
67
|
-
import '../../FooterAnimationContext/index.js';
|
|
68
|
-
import '../../WalletGroupContext/WalletGroupContext.js';
|
|
69
|
-
import '../../MfaSettingsContext/MfaSettingsContext.js';
|
|
70
|
-
import '../../IpConfigurationContext/IpConfigurationContext.js';
|
|
71
|
-
import '../../PasskeyContext/PasskeyContext.js';
|
|
72
|
-
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
73
|
-
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
74
|
-
import '../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
75
|
-
import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
76
16
|
|
|
77
17
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
78
18
|
const [callbackQueue, setCallbackQueue] = useState([]);
|
|
79
|
-
const handleNextCallback = useCallback((next,
|
|
19
|
+
const handleNextCallback = useCallback((next, user) => {
|
|
80
20
|
switch (next === null || next === void 0 ? void 0 : next.callback) {
|
|
81
21
|
case 'authSuccess': {
|
|
82
22
|
try {
|
|
83
23
|
onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess({
|
|
84
|
-
authToken,
|
|
85
24
|
handleLogOut,
|
|
86
25
|
isAuthenticated,
|
|
87
|
-
minAuthToken,
|
|
88
26
|
primaryWallet,
|
|
89
27
|
user,
|
|
90
28
|
});
|
|
@@ -116,16 +54,14 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
116
54
|
useEffect(() => {
|
|
117
55
|
if (!callbackQueue.length || !user)
|
|
118
56
|
return;
|
|
119
|
-
const authToken = getAuthToken();
|
|
120
|
-
const minAuthToken = getMinAuthToken();
|
|
121
57
|
// checks if user logged in with a wallet, so we need to wait
|
|
122
58
|
// for the primary wallet state to be set
|
|
123
59
|
// if user logged in with email without embedded wallet, then
|
|
124
60
|
// there is no wallet so we can go ahead and run the callback
|
|
125
|
-
if (
|
|
61
|
+
if (user.isAuthenticatedWithAWallet && !primaryWallet) {
|
|
126
62
|
return;
|
|
127
63
|
}
|
|
128
|
-
handleNextCallback(callbackQueue[0],
|
|
64
|
+
handleNextCallback(callbackQueue[0], user);
|
|
129
65
|
setCallbackQueue((prev) => {
|
|
130
66
|
const [resolvedCallback, ...updatedQueue] = prev;
|
|
131
67
|
if (resolvedCallback) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './externalAuth';
|
package/src/lib/events/auth.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ type AuthEventPayloadOptionMap = {
|
|
|
10
10
|
sms: AuthOptions['sms']['phone'];
|
|
11
11
|
email: AuthOptions['email']['email'];
|
|
12
12
|
social: AuthOptions['social']['provider'];
|
|
13
|
+
externalAuth: AuthOptions['externalAuth']['externalUserId'];
|
|
13
14
|
};
|
|
14
15
|
/** Payload of auth events that provide insight into which auth method was selected */
|
|
15
16
|
export type AuthEventPayload = {
|
|
@@ -2,7 +2,7 @@ import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
|
2
2
|
import { Wallet } from '../shared/types/wallets';
|
|
3
3
|
import { UserProfile } from '../..';
|
|
4
4
|
export type EmbeddedWalletEvents = {
|
|
5
|
-
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined,
|
|
5
|
+
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined, user: UserProfile | undefined) => void;
|
|
6
6
|
embeddedWalletFailed: (error: unknown) => void;
|
|
7
7
|
embeddedWalletRevealCompleted: (wallet: Wallet) => void;
|
|
8
8
|
embeddedWalletRevealFailed: (error: unknown) => void;
|
|
@@ -1768,8 +1768,8 @@ const translation = {
|
|
|
1768
1768
|
search: {
|
|
1769
1769
|
label: 'Search through {{numberOfWallets}} wallets...',
|
|
1770
1770
|
not_found: {
|
|
1771
|
-
description: '
|
|
1772
|
-
title: '
|
|
1771
|
+
description: 'The wallet you’re looking for may not be available, or linking more than one of these wallets might not be possible.',
|
|
1772
|
+
title: 'Wallet not available',
|
|
1773
1773
|
},
|
|
1774
1774
|
},
|
|
1775
1775
|
title: {
|
|
@@ -1790,8 +1790,8 @@ const translation = {
|
|
|
1790
1790
|
search: {
|
|
1791
1791
|
label: 'Search through {{numberOfWallets}} wallets...',
|
|
1792
1792
|
not_found: {
|
|
1793
|
-
description: '
|
|
1794
|
-
title: '
|
|
1793
|
+
description: 'The wallet you’re looking for may not be available, or linking more than one of these wallets might not be possible.',
|
|
1794
|
+
title: 'Wallet not available',
|
|
1795
1795
|
},
|
|
1796
1796
|
},
|
|
1797
1797
|
title: {
|
|
@@ -1764,8 +1764,8 @@ export declare const translation: {
|
|
|
1764
1764
|
search: {
|
|
1765
1765
|
label: 'Search through {{numberOfWallets}} wallets...',
|
|
1766
1766
|
not_found: {
|
|
1767
|
-
description: '
|
|
1768
|
-
title: '
|
|
1767
|
+
description: 'The wallet you’re looking for may not be available, or linking more than one of these wallets might not be possible.',
|
|
1768
|
+
title: 'Wallet not available',
|
|
1769
1769
|
},
|
|
1770
1770
|
},
|
|
1771
1771
|
title: {
|
|
@@ -1764,8 +1764,8 @@ const translation = {
|
|
|
1764
1764
|
search: {
|
|
1765
1765
|
label: 'Search through {{numberOfWallets}} wallets...',
|
|
1766
1766
|
not_found: {
|
|
1767
|
-
description: '
|
|
1768
|
-
title: '
|
|
1767
|
+
description: 'The wallet you’re looking for may not be available, or linking more than one of these wallets might not be possible.',
|
|
1768
|
+
title: 'Wallet not available',
|
|
1769
1769
|
},
|
|
1770
1770
|
},
|
|
1771
1771
|
title: {
|
|
@@ -1786,8 +1786,8 @@ const translation = {
|
|
|
1786
1786
|
search: {
|
|
1787
1787
|
label: 'Search through {{numberOfWallets}} wallets...',
|
|
1788
1788
|
not_found: {
|
|
1789
|
-
description: '
|
|
1790
|
-
title: '
|
|
1789
|
+
description: 'The wallet you’re looking for may not be available, or linking more than one of these wallets might not be possible.',
|
|
1790
|
+
title: 'Wallet not available',
|
|
1791
1791
|
},
|
|
1792
1792
|
},
|
|
1793
1793
|
title: {
|
|
@@ -31,9 +31,7 @@ export type DynamicEventsCallbacks = {
|
|
|
31
31
|
onAuthInit?: (data: AuthEventPayload) => void;
|
|
32
32
|
};
|
|
33
33
|
export type OnAuthSuccess = (params: {
|
|
34
|
-
authToken: string;
|
|
35
34
|
handleLogOut: () => Promise<void>;
|
|
36
|
-
minAuthToken: string;
|
|
37
35
|
isAuthenticated: boolean;
|
|
38
36
|
primaryWallet: Wallet | null;
|
|
39
37
|
user: UserProfile;
|
|
@@ -58,4 +56,4 @@ destination: {
|
|
|
58
56
|
value: PhoneData;
|
|
59
57
|
}) => void;
|
|
60
58
|
export type OnUserProfileUpdate = (user: UserProfile) => void;
|
|
61
|
-
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined,
|
|
59
|
+
export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined, user: UserProfile | undefined) => void;
|