@dynamic-labs/sdk-react-core 0.17.0-RC.2 → 0.17.0-RC.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +6 -6
  5. package/src/index.cjs +2 -2
  6. package/src/index.js +1 -1
  7. package/src/lib/context/DynamicContext/DynamicContext.cjs +17 -5
  8. package/src/lib/context/DynamicContext/DynamicContext.d.ts +1 -0
  9. package/src/lib/context/DynamicContext/DynamicContext.js +17 -5
  10. package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
  11. package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
  12. package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
  13. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -0
  14. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +1 -0
  15. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -0
  16. package/src/lib/data/api.cjs +6 -1
  17. package/src/lib/data/api.js +7 -2
  18. package/src/lib/shared/utils/hooks/useGlobalLoading/index.d.ts +1 -0
  19. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +35 -0
  20. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.d.ts +17 -0
  21. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +31 -0
  22. package/src/lib/styles/index.shadow.cjs +1 -1
  23. package/src/lib/styles/index.shadow.js +1 -1
  24. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -2
  25. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -1
  26. package/src/lib/views/EmailVerification/EmailVerification.js +4 -1
  27. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +3 -6
  28. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +3 -6
  29. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +5 -6
  30. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +5 -6
  31. package/src/lib/views/{WalletNoAccess/WalletNoAccess.cjs → NoAccess/NoAccess.cjs} +17 -5
  32. package/src/lib/views/NoAccess/NoAccess.d.ts +2 -0
  33. package/src/lib/views/{WalletNoAccess/WalletNoAccess.js → NoAccess/NoAccess.js} +19 -7
  34. package/src/lib/views/NoAccess/index.d.ts +1 -0
  35. package/src/lib/views/WalletList/data.cjs +0 -6
  36. package/src/lib/views/WalletList/data.d.ts +0 -1
  37. package/src/lib/views/WalletList/data.js +1 -6
  38. package/src/lib/views/index.d.ts +1 -1
  39. package/src/lib/views/viewToComponentMap.cjs +3 -3
  40. package/src/lib/views/viewToComponentMap.js +3 -3
  41. package/src/lib/views/WalletNoAccess/WalletNoAccess.d.ts +0 -2
  42. package/src/lib/views/WalletNoAccess/index.d.ts +0 -1
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const NoAccess: () => JSX.Element;
@@ -1,13 +1,14 @@
1
1
  import { __awaiter } from '../../../../_virtual/_tslib.js';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { useState, useEffect } from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useState, useEffect, useMemo } from 'react';
4
4
  import { WalletIcon } from '@dynamic-labs/wallet-book';
5
+ import { SignInWithEmailIcon } from '@dynamic-labs/iconic';
5
6
  import { Typography } from '../../components/Typography/Typography.js';
6
7
  import '@dynamic-labs/sdk-api';
7
8
  import '../../shared/logger.js';
8
- import '@dynamic-labs/iconic';
9
9
  import '@dynamic-labs/multi-wallet';
10
10
  import { useViewContext } from '../../context/ViewContext/ViewContext.js';
11
+ import { ReactComponent as SvgError } from '../../shared/assets/error.js';
11
12
  import '../../utils/constants/colors.js';
12
13
  import '../../shared/consts/index.js';
13
14
  import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
@@ -27,12 +28,15 @@ import '../../context/CaptchaContext/CaptchaContext.js';
27
28
  import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
28
29
  import { Button } from '../../components/Button/Button.js';
29
30
  import '../../components/IconButton/IconButton.js';
31
+ import { IconWithStatus } from '../../components/IconWithStatus/IconWithStatus.js';
30
32
  import { StatusDot } from '../../components/StatusDot/StatusDot.js';
31
33
  import { getSocialNetworkIcon } from '../../utils/functions/getSocialNetworkIcon/getSocialNetworkIcon.js';
34
+ import { useEmailVerificationContext } from '../../context/EmailVerificationContext/EmailVerificationContext.js';
32
35
 
33
- const WalletNoAccess = () => {
36
+ const NoAccess = () => {
34
37
  const [walletAddress, setWalletAddress] = useState('');
35
38
  const { loginWithEmail, selectedWalletConnector: walletConnector, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, notInTheListImageUrl, accessDeniedMessagePrimary, accessDeniedMessageSecondary, } = useInternalDynamicContext();
39
+ const { email } = useEmailVerificationContext();
36
40
  const { setView, view } = useViewContext();
37
41
  const isChainalysisView = view === 'chainalysis-blocked-wallet';
38
42
  const _socialMediaLinkText = !isChainalysisView
@@ -65,11 +69,19 @@ const WalletNoAccess = () => {
65
69
  const subtitle = isChainalysisView
66
70
  ? 'This wallet has been correlated to illicit activity and cannot access this site.'
67
71
  : accessDeniedMessageSecondary ||
68
- "We couldn't find your wallet address on our allow list of customers.";
72
+ "We couldn't find your wallet address or email on our allow list of customers.";
69
73
  const SocialMediaIcon = !socialMediaIconUrl || typeof socialMediaIconUrl === 'string'
70
74
  ? null
71
75
  : getSocialNetworkIcon(Object.keys(socialMediaIconUrl)[0]);
72
- return (jsxs("div", Object.assign({ className: 'wallet-no-access__container' }, { children: [notInTheListImageUrl && !isChainalysisView && (jsx("img", { src: notInTheListImageUrl, alt: 'user is not in the list', className: 'wallet-no-access__image' })), jsxs("div", Object.assign({ className: 'wallet-no-access__main' }, { children: [jsxs("div", Object.assign({ className: 'wallet-no-access__user-info-container' }, { children: [jsx(WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: { height: pixelToRem(64), width: pixelToRem(64) } }), jsxs("div", Object.assign({ className: 'wallet-no-access__wallet-address-container' }, { children: [jsx(StatusDot, { variant: 'red', containerClassName: 'user-info__status-dot' }), jsx(Typography, Object.assign({ variant: 'body_normal', color: 'primary', weight: 'medium', className: 'wallet-no-access__wallet-address' }, { children: walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.replace(walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.substring(6, Number(walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.length) - 4), '...') }))] }))] })), jsxs("div", Object.assign({ className: 'wallet-no-access__content' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'wallet-no-access__content--primary' }, { children: title })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'wallet-no-access__content--secondary' }, { children: subtitle }))] })), jsx(Button, Object.assign({ onClick: handleChangeWallet, className: 'wallet-no-access__button--primary', expanded: true, buttonRounded: 'default', buttonPadding: 'large' }, { children: "Try another wallet" })), Boolean(_socialMediaUrl) && Boolean(_socialMediaLinkText) && (jsxs("div", Object.assign({ className: 'wallet-no-access__social-info-container' }, { children: [jsxs("a", Object.assign({ href: _socialMediaUrl, className: 'wallet-no-access__waitlist-link' }, { children: [jsx(Typography, Object.assign({ variant: 'button_primary', color: 'primary' }, { children: _socialMediaLinkText })), SocialMediaIcon && !isChainalysisView && (jsx(SocialMediaIcon, { className: 'wallet-no-access__social-icon', style: {
76
+ const Icon = useMemo(() => {
77
+ if (walletConnector) {
78
+ return (jsx(WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: { height: pixelToRem(64), width: pixelToRem(64) } }));
79
+ }
80
+ return (jsx(IconWithStatus, { containerClassName: 'wallet-no-access__icon--verified', Icon: SignInWithEmailIcon, iconSize: 50, InnerIcon: SvgError, variant: 'red' }));
81
+ }, [walletConnector]);
82
+ return (jsxs("div", Object.assign({ className: 'wallet-no-access__container' }, { children: [notInTheListImageUrl && !isChainalysisView && (jsx("img", { src: notInTheListImageUrl, alt: 'user is not in the list', className: 'wallet-no-access__image' })), jsxs("div", Object.assign({ className: 'wallet-no-access__main' }, { children: [jsxs("div", Object.assign({ className: 'wallet-no-access__user-info-container' }, { children: [Icon, jsxs("div", Object.assign({ "data-testid": 'walletAddress', className: 'wallet-no-access__wallet-address-container' }, { children: [walletConnector && (jsx(StatusDot, { variant: 'red', containerClassName: 'user-info__status-dot' })), jsx(Typography, Object.assign({ variant: 'body_normal', color: 'primary', weight: 'medium', className: 'wallet-no-access__wallet-address' }, { children: walletConnector
83
+ ? walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.replace(walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.substring(6, Number(walletAddress === null || walletAddress === void 0 ? void 0 : walletAddress.length) - 4), '...')
84
+ : email }))] }))] })), jsxs("div", Object.assign({ className: 'wallet-no-access__content' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'wallet-no-access__content--primary' }, { children: title })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'wallet-no-access__content--secondary' }, { children: subtitle }))] })), jsx(Button, Object.assign({ onClick: handleChangeWallet, className: 'wallet-no-access__button--primary', expanded: true, buttonRounded: 'default', buttonPadding: 'large' }, { children: "Try another method" })), Boolean(_socialMediaUrl) && Boolean(_socialMediaLinkText) && (jsxs("div", Object.assign({ className: 'wallet-no-access__social-info-container' }, { children: [jsxs("a", Object.assign({ href: _socialMediaUrl, className: 'wallet-no-access__waitlist-link' }, { children: [jsx(Typography, Object.assign({ variant: 'button_primary', color: 'primary' }, { children: _socialMediaLinkText })), SocialMediaIcon && !isChainalysisView && (jsx(SocialMediaIcon, { className: 'wallet-no-access__social-icon', style: {
73
85
  height: pixelToRem(24),
74
86
  width: pixelToRem(24),
75
87
  } }))] })), typeof socialMediaIconUrl === 'string' && (jsx("img", { alt: 'social media', src: socialMediaIconUrl, style: {
@@ -78,4 +90,4 @@ const WalletNoAccess = () => {
78
90
  } }))] })))] }))] })));
79
91
  };
80
92
 
81
- export { WalletNoAccess };
93
+ export { NoAccess };
@@ -0,0 +1 @@
1
+ export { NoAccess } from './NoAccess';
@@ -18,15 +18,10 @@ const getEnabledChains = (chains) => chains
18
18
  .filter(({ enabled }) => enabled)
19
19
  .map(({ name }) => { var _a; return (_a = multiWallet.getChainInfo(name)) === null || _a === void 0 ? void 0 : _a.symbol; })
20
20
  .filter((chain) => Boolean(chain));
21
- const getEnabledCosmosNetworks = (chains) => {
22
- var _a, _b, _c;
23
- return ((_c = (_b = (_a = chains.find(({ enabled, name }) => enabled && name === 'cosmos')) === null || _a === void 0 ? void 0 : _a.networks) === null || _b === void 0 ? void 0 : _b.filter(({ enabled }) => enabled)) === null || _c === void 0 ? void 0 : _c.map(({ networkId }) => networkId)) || [];
24
- };
25
21
  const createWallets = (props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
26
22
  var _a, _b, _c, _d;
27
23
  return (yield multiWallet.getEnabledWallets({
28
24
  enabledChains: getEnabledChains(props.settings.chains),
29
- enabledNetworks: getEnabledCosmosNetworks(props.settings.chains),
30
25
  getSupportedWalletOpts: Object.assign(Object.assign({}, props.getSupportedWalletOpts), { isWalletConnectV2Enabled: ((_a = props.settings.sdk.walletConnect) === null || _a === void 0 ? void 0 : _a.v2Enabled) &&
31
26
  ((_b = props.settings.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId)
32
27
  ? (_c = props.settings.sdk.walletConnect) === null || _c === void 0 ? void 0 : _c.v2Enabled
@@ -46,6 +41,5 @@ const getNotInstalledWallets = (settings, getSupportedWalletOpts) => createWalle
46
41
  });
47
42
 
48
43
  exports.getEnabledChains = getEnabledChains;
49
- exports.getEnabledCosmosNetworks = getEnabledCosmosNetworks;
50
44
  exports.getInstalledWallets = getInstalledWallets;
51
45
  exports.getNotInstalledWallets = getNotInstalledWallets;
@@ -5,7 +5,6 @@ interface IChain {
5
5
  name: string;
6
6
  }
7
7
  export declare const getEnabledChains: (chains: IChain[]) => ("ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS")[];
8
- export declare const getEnabledCosmosNetworks: (chains: IChain[]) => number[];
9
8
  type BaseGetSupportedWalletOpts = Omit<GetSupportedWalletsOpts, 'isWalletConnectV2Enabled' | 'walletConnectProjectId'>;
10
9
  export declare const getInstalledWallets: (settings: ProjectSettings, getSupportedWalletOpts: BaseGetSupportedWalletOpts) => Promise<import("../../shared").WalletOption[]>;
11
10
  export declare const getNotInstalledWallets: (settings: ProjectSettings, getSupportedWalletOpts: BaseGetSupportedWalletOpts) => Promise<import("../../shared").WalletOption[]>;
@@ -14,15 +14,10 @@ const getEnabledChains = (chains) => chains
14
14
  .filter(({ enabled }) => enabled)
15
15
  .map(({ name }) => { var _a; return (_a = getChainInfo(name)) === null || _a === void 0 ? void 0 : _a.symbol; })
16
16
  .filter((chain) => Boolean(chain));
17
- const getEnabledCosmosNetworks = (chains) => {
18
- var _a, _b, _c;
19
- return ((_c = (_b = (_a = chains.find(({ enabled, name }) => enabled && name === 'cosmos')) === null || _a === void 0 ? void 0 : _a.networks) === null || _b === void 0 ? void 0 : _b.filter(({ enabled }) => enabled)) === null || _c === void 0 ? void 0 : _c.map(({ networkId }) => networkId)) || [];
20
- };
21
17
  const createWallets = (props) => __awaiter(void 0, void 0, void 0, function* () {
22
18
  var _a, _b, _c, _d;
23
19
  return (yield getEnabledWallets({
24
20
  enabledChains: getEnabledChains(props.settings.chains),
25
- enabledNetworks: getEnabledCosmosNetworks(props.settings.chains),
26
21
  getSupportedWalletOpts: Object.assign(Object.assign({}, props.getSupportedWalletOpts), { isWalletConnectV2Enabled: ((_a = props.settings.sdk.walletConnect) === null || _a === void 0 ? void 0 : _a.v2Enabled) &&
27
22
  ((_b = props.settings.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId)
28
23
  ? (_c = props.settings.sdk.walletConnect) === null || _c === void 0 ? void 0 : _c.v2Enabled
@@ -41,4 +36,4 @@ const getNotInstalledWallets = (settings, getSupportedWalletOpts) => createWalle
41
36
  settings,
42
37
  });
43
38
 
44
- export { getEnabledChains, getEnabledCosmosNetworks, getInstalledWallets, getNotInstalledWallets };
39
+ export { getEnabledChains, getInstalledWallets, getNotInstalledWallets };
@@ -3,7 +3,7 @@ export { PendingSignatureView } from './PendingSignatureView';
3
3
  export { CollectUserDataView } from './CollectUserDataView';
4
4
  export { NoQrNotInstalledView } from './/NoQrNotInstalledView';
5
5
  export { QrCodeView } from './QrCodeView';
6
- export { WalletNoAccess } from './WalletNoAccess';
6
+ export { NoAccess } from './NoAccess';
7
7
  export { EmailConfirmationWaitingView } from './EmailConfirmationWaitingView';
8
8
  export { viewToComponentMap } from './viewToComponentMap';
9
9
  export { NetworkNotSupportedSwitchManual } from './NetworkNotSupportedSwitchManual';
@@ -19,13 +19,13 @@ var PendingSignatureView = require('./PendingSignatureView/PendingSignatureView.
19
19
  var QrCodeView = require('./QrCodeView/QrCodeView.cjs');
20
20
  var SocialRedirectView = require('./SocialRedirectView/SocialRedirectView.cjs');
21
21
  var WalletList = require('./WalletList/WalletList.cjs');
22
- var WalletNoAccess = require('./WalletNoAccess/WalletNoAccess.cjs');
22
+ var NoAccess = require('./NoAccess/NoAccess.cjs');
23
23
  var WalletSignSpinnerView = require('./WalletSignSpinnerView/WalletSignSpinnerView.cjs');
24
24
  var WalletUsedView = require('./WalletUsedView/WalletUsedView.cjs');
25
25
 
26
26
  const viewToComponentMap = {
27
27
  captcha: jsxRuntime.jsx(CaptchaVerifyUser.CaptchaVerifyUser, {}),
28
- 'chainalysis-blocked-wallet': jsxRuntime.jsx(WalletNoAccess.WalletNoAccess, {}),
28
+ 'chainalysis-blocked-wallet': jsxRuntime.jsx(NoAccess.NoAccess, {}),
29
29
  'collect-user-data': jsxRuntime.jsx(CollectUserDataView.CollectUserDataView, {}),
30
30
  'collect-user-data-login-with-email': jsxRuntime.jsx(CollectUserDataViewLoginWithEmail.CollectUserDataViewLoginWithEmail, {}),
31
31
  'email-wallet-otp-verification-view': jsxRuntime.jsx(EmailWalletOTPVerificationView.EmailWalletOTPVerificationView, {}),
@@ -34,7 +34,7 @@ const viewToComponentMap = {
34
34
  'login-with-email-verification': jsxRuntime.jsx(EmailVerification.EmailVerification, {}),
35
35
  'network-not-supported': jsxRuntime.jsx(NetworkNotSupported.NetworkNotSupported, {}),
36
36
  'network-not-supported-manual': jsxRuntime.jsx(NetworkNotSupportedSwitchManual.NetworkNotSupportedSwitchManual, {}),
37
- 'no-access': jsxRuntime.jsx(WalletNoAccess.WalletNoAccess, {}),
37
+ 'no-access': jsxRuntime.jsx(NoAccess.NoAccess, {}),
38
38
  'no-qr-not-installed': jsxRuntime.jsx(NoQrNotInstalledView.NoQrNotInstalledView, {}),
39
39
  'pending-connect': jsxRuntime.jsx(PendingConnectView.PendingConnectView, {}),
40
40
  'pending-signature': jsxRuntime.jsx(PendingSignatureView.PendingSignatureView, {}),
@@ -15,13 +15,13 @@ import { PendingSignatureView } from './PendingSignatureView/PendingSignatureVie
15
15
  import { QrCodeView } from './QrCodeView/QrCodeView.js';
16
16
  import { SocialRedirectView } from './SocialRedirectView/SocialRedirectView.js';
17
17
  import { WalletList } from './WalletList/WalletList.js';
18
- import { WalletNoAccess } from './WalletNoAccess/WalletNoAccess.js';
18
+ import { NoAccess } from './NoAccess/NoAccess.js';
19
19
  import { WalletSignSpinnerView } from './WalletSignSpinnerView/WalletSignSpinnerView.js';
20
20
  import { WalletUsedView } from './WalletUsedView/WalletUsedView.js';
21
21
 
22
22
  const viewToComponentMap = {
23
23
  captcha: jsx(CaptchaVerifyUser, {}),
24
- 'chainalysis-blocked-wallet': jsx(WalletNoAccess, {}),
24
+ 'chainalysis-blocked-wallet': jsx(NoAccess, {}),
25
25
  'collect-user-data': jsx(CollectUserDataView, {}),
26
26
  'collect-user-data-login-with-email': jsx(CollectUserDataViewLoginWithEmail, {}),
27
27
  'email-wallet-otp-verification-view': jsx(EmailWalletOTPVerificationView, {}),
@@ -30,7 +30,7 @@ const viewToComponentMap = {
30
30
  'login-with-email-verification': jsx(EmailVerification, {}),
31
31
  'network-not-supported': jsx(NetworkNotSupported, {}),
32
32
  'network-not-supported-manual': jsx(NetworkNotSupportedSwitchManual, {}),
33
- 'no-access': jsx(WalletNoAccess, {}),
33
+ 'no-access': jsx(NoAccess, {}),
34
34
  'no-qr-not-installed': jsx(NoQrNotInstalledView, {}),
35
35
  'pending-connect': jsx(PendingConnectView, {}),
36
36
  'pending-signature': jsx(PendingSignatureView, {}),
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const WalletNoAccess: () => JSX.Element;
@@ -1 +0,0 @@
1
- export { WalletNoAccess } from './WalletNoAccess';