@dynamic-labs/sdk-react-core 0.17.0-RC.13 → 0.17.0-RC.14

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 (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +8 -8
  5. package/src/lib/components/UserProfile/UserProfile.cjs +2 -2
  6. package/src/lib/components/UserProfile/UserProfile.js +1 -1
  7. package/src/lib/context/DynamicContext/DynamicContext.cjs +17 -7
  8. package/src/lib/context/DynamicContext/DynamicContext.d.ts +9 -2
  9. package/src/lib/context/DynamicContext/DynamicContext.js +17 -7
  10. package/src/lib/data/api.cjs +2 -1
  11. package/src/lib/data/api.d.ts +1 -1
  12. package/src/lib/data/api.js +2 -1
  13. package/src/lib/shared/types/index.d.ts +6 -0
  14. package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.cjs → getUserProfileFields/getUserProfileFields.cjs} +4 -0
  15. package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.js → getUserProfileFields/getUserProfileFields.js} +4 -0
  16. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.cjs +2 -0
  17. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.d.ts +1 -0
  18. package/src/lib/utils/functions/getVerifyArgs/getVerifyArgs.js +2 -0
  19. package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.cjs +4 -4
  20. package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.js +3 -3
  21. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +79 -44
  22. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +4 -2
  23. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +80 -45
  24. package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +7 -10
  25. package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +7 -10
  26. package/src/lib/utils/hooks/useWallets/useWallets.cjs +4 -1
  27. package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -1
  28. package/src/lib/utils/hooks/useWallets/useWallets.js +4 -1
  29. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.cjs +4 -5
  30. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.js +4 -5
  31. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -2
  32. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -2
  33. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +11 -14
  34. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.d.ts +2 -3
  35. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +11 -14
  36. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +0 -8
  37. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.d.ts +0 -4
  38. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -9
  39. package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs +1 -1
  40. package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js +1 -1
  41. package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +2 -2
  42. package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.d.ts +4 -3
  43. package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +2 -2
  44. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +3 -5
  45. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +3 -5
  46. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +4 -4
  47. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +4 -4
  48. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +3 -2
  49. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +2 -1
  50. /package/src/lib/utils/functions/{getEnabledUserProfileFields/getEnabledUserProfileFields.d.ts → getUserProfileFields/getUserProfileFields.d.ts} +0 -0
@@ -42,14 +42,14 @@ var Wallet = require('../Wallet/Wallet.cjs');
42
42
 
43
43
  const DynamicWidgetWallets = () => {
44
44
  const { secondaryWallets, user } = useInternalDynamicContext.useInternalDynamicContext();
45
- const { setNewWalletId, availableWalletsContainerRef } = DynamicWidgetContext.useWidgetContext();
45
+ const { availableWalletsContainerRef } = DynamicWidgetContext.useWidgetContext();
46
46
  const isEmpty = secondaryWallets.length === 0;
47
47
  const isKYCEnabled = useKYCFlag.useKYCFlag();
48
48
  return (jsxRuntime.jsxs("div", Object.assign({ ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets' }, { children: [!isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets__title' }, { children: "My wallets" }))), jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('available-wallets__body', {
49
49
  'dynamic-widget-wallets__body--apply-height': !isEmpty,
50
50
  }) }, { children: isEmpty ? (jsxRuntime.jsx(EmptyWallets.EmptyWallets, {})) : (jsxRuntime.jsx("div", Object.assign({ className: 'available-wallets__wallet-list' }, { children: secondaryWallets.map((wallet, index) => {
51
51
  var _a;
52
- return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet, setNewWalletId: setNewWalletId }, wallet.id));
52
+ return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
53
53
  }) }))) }))] })));
54
54
  };
55
55
 
@@ -38,14 +38,14 @@ import { Wallet } from '../Wallet/Wallet.js';
38
38
 
39
39
  const DynamicWidgetWallets = () => {
40
40
  const { secondaryWallets, user } = useInternalDynamicContext();
41
- const { setNewWalletId, availableWalletsContainerRef } = useWidgetContext();
41
+ const { availableWalletsContainerRef } = useWidgetContext();
42
42
  const isEmpty = secondaryWallets.length === 0;
43
43
  const isKYCEnabled = useKYCFlag();
44
44
  return (jsxs("div", Object.assign({ ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets' }, { children: [!isKYCEnabled && (jsx(Typography, Object.assign({ weight: 'regular', variant: 'body_normal', color: 'secondary', className: 'dynamic-widget-wallets__title' }, { children: "My wallets" }))), jsx("div", Object.assign({ className: classNames('available-wallets__body', {
45
45
  'dynamic-widget-wallets__body--apply-height': !isEmpty,
46
46
  }) }, { children: isEmpty ? (jsx(EmptyWallets, {})) : (jsx("div", Object.assign({ className: 'available-wallets__wallet-list' }, { children: secondaryWallets.map((wallet, index) => {
47
47
  var _a;
48
- return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet, setNewWalletId: setNewWalletId }, wallet.id));
48
+ return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
49
49
  }) }))) }))] })));
50
50
  };
51
51
 
@@ -41,14 +41,10 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
41
41
  var DotsMenu = require('../DotsMenu/DotsMenu.cjs');
42
42
  var helpers = require('../../helpers/helpers.cjs');
43
43
  var WalletIconWithStatus = require('../WalletIconWithStatus/WalletIconWithStatus.cjs');
44
- var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
45
44
 
46
- const Wallet = ({ setNewWalletId, wallet, ens }) => {
47
- const walletPublicKey = wallet.address;
48
- const walletId = wallet.id;
49
- const { connector } = wallet;
50
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
51
- const { setWalletIdToUnlink } = DynamicWidgetContext.useWidgetContext();
45
+ const Wallet = ({ wallet, ens }) => {
46
+ const { id: walletId, connector, address, connected } = wallet;
47
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setSelectedWalletWithAction, } = useInternalDynamicContext.useInternalDynamicContext();
52
48
  const iconSize = 20;
53
49
  const options = [
54
50
  {
@@ -66,23 +62,24 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
66
62
  }
67
63
  options.push({
68
64
  Icon: jsxRuntime.jsx(copy.ReactComponent, {}),
69
- callback: () => helpers.copyToClipboard(walletPublicKey || ''),
65
+ callback: () => helpers.copyToClipboard(address || ''),
70
66
  text: 'Copy address',
71
67
  }, {
72
68
  Icon: jsxRuntime.jsx(unlink.ReactComponent, {}),
73
- callback: () => setWalletIdToUnlink(walletId),
69
+ callback: () => setSelectedWalletWithAction({ action: 'unlink', wallet }),
74
70
  text: 'Unlink from my account',
75
71
  });
76
72
  const onSelectWalletClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
77
- if (wallet.connector.connectedChain === 'FLOW') {
78
- wallet.connector.endSession();
73
+ var _a;
74
+ if (connector.connectedChain === 'FLOW') {
75
+ (_a = connector.endSession) === null || _a === void 0 ? void 0 : _a.call(connector);
79
76
  }
80
- setNewWalletId === null || setNewWalletId === void 0 ? void 0 : setNewWalletId(walletId);
77
+ setSelectedWalletWithAction({ action: 'select', wallet });
81
78
  setPrimaryWallet(walletId);
82
79
  computeConnectedStateForWallets();
83
- setSelectedWalletConnector(wallet.connector);
80
+ setSelectedWalletConnector(connector);
84
81
  });
85
- return (jsxRuntime.jsxs("div", Object.assign({ className: 'wallet__container', "data-testid": 'wallet' }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet__row' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'wallet__icon-container' }, { children: jsxRuntime.jsx(WalletIconWithStatus.WalletIconWithStatus, { iconSize: iconSize, walletName: connector.name, connected: wallet.connected, variant: 'secondary' }) })), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true }, { children: ens === null || ens === void 0 ? void 0 : ens.name })), jsxRuntime.jsx("div", { className: 'wallet__row__seperator' }), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: shortenWalletAddress.shortenWalletAddress(walletPublicKey, 3, 3) }))] })) : (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', color: 'primary' }, { children: shortenWalletAddress.shortenWalletAddress(walletPublicKey, 4, 4) })))] })), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, title: 'Wallet options', buttonClassName: 'wallet__menu' })] })));
82
+ return (jsxRuntime.jsxs("div", Object.assign({ className: 'wallet__container', "data-testid": 'wallet' }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet__row' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'wallet__icon-container' }, { children: jsxRuntime.jsx(WalletIconWithStatus.WalletIconWithStatus, { iconSize: iconSize, walletName: connector.name, connected: connected, variant: 'secondary' }) })), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true }, { children: ens === null || ens === void 0 ? void 0 : ens.name })), jsxRuntime.jsx("div", { className: 'wallet__row__seperator' }), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: shortenWalletAddress.shortenWalletAddress(address, 3, 3) }))] })) : (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', color: 'primary' }, { children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) })))] })), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, title: 'Wallet options', buttonClassName: 'wallet__menu' })] })));
86
83
  };
87
84
 
88
85
  exports.Wallet = Wallet;
@@ -1,4 +1,4 @@
1
- import { Dispatch, SetStateAction } from 'react';
1
+ /// <reference types="react" />
2
2
  import { NameServiceData } from '@dynamic-labs/sdk-api';
3
3
  import { Wallet as WalletType } from '../../../../shared/types';
4
4
  type Props = {
@@ -6,8 +6,7 @@ type Props = {
6
6
  expanded?: boolean;
7
7
  expandedWallet?: string;
8
8
  setExpandedWallet?: (str?: string) => void;
9
- setNewWalletId?: Dispatch<SetStateAction<string>>;
10
9
  wallet: WalletType;
11
10
  };
12
- export declare const Wallet: ({ setNewWalletId, wallet, ens }: Props) => JSX.Element;
11
+ export declare const Wallet: ({ wallet, ens }: Props) => JSX.Element;
13
12
  export {};
@@ -37,14 +37,10 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
37
37
  import { DotsMenu } from '../DotsMenu/DotsMenu.js';
38
38
  import { copyToClipboard } from '../../helpers/helpers.js';
39
39
  import { WalletIconWithStatus } from '../WalletIconWithStatus/WalletIconWithStatus.js';
40
- import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
41
40
 
42
- const Wallet = ({ setNewWalletId, wallet, ens }) => {
43
- const walletPublicKey = wallet.address;
44
- const walletId = wallet.id;
45
- const { connector } = wallet;
46
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, } = useInternalDynamicContext();
47
- const { setWalletIdToUnlink } = useWidgetContext();
41
+ const Wallet = ({ wallet, ens }) => {
42
+ const { id: walletId, connector, address, connected } = wallet;
43
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setSelectedWalletWithAction, } = useInternalDynamicContext();
48
44
  const iconSize = 20;
49
45
  const options = [
50
46
  {
@@ -62,23 +58,24 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
62
58
  }
63
59
  options.push({
64
60
  Icon: jsx(SvgCopy, {}),
65
- callback: () => copyToClipboard(walletPublicKey || ''),
61
+ callback: () => copyToClipboard(address || ''),
66
62
  text: 'Copy address',
67
63
  }, {
68
64
  Icon: jsx(SvgUnlink, {}),
69
- callback: () => setWalletIdToUnlink(walletId),
65
+ callback: () => setSelectedWalletWithAction({ action: 'unlink', wallet }),
70
66
  text: 'Unlink from my account',
71
67
  });
72
68
  const onSelectWalletClick = () => __awaiter(void 0, void 0, void 0, function* () {
73
- if (wallet.connector.connectedChain === 'FLOW') {
74
- wallet.connector.endSession();
69
+ var _a;
70
+ if (connector.connectedChain === 'FLOW') {
71
+ (_a = connector.endSession) === null || _a === void 0 ? void 0 : _a.call(connector);
75
72
  }
76
- setNewWalletId === null || setNewWalletId === void 0 ? void 0 : setNewWalletId(walletId);
73
+ setSelectedWalletWithAction({ action: 'select', wallet });
77
74
  setPrimaryWallet(walletId);
78
75
  computeConnectedStateForWallets();
79
- setSelectedWalletConnector(wallet.connector);
76
+ setSelectedWalletConnector(connector);
80
77
  });
81
- return (jsxs("div", Object.assign({ className: 'wallet__container', "data-testid": 'wallet' }, { children: [jsxs("div", Object.assign({ className: 'wallet__row' }, { children: [jsx("div", Object.assign({ className: 'wallet__icon-container' }, { children: jsx(WalletIconWithStatus, { iconSize: iconSize, walletName: connector.name, connected: wallet.connected, variant: 'secondary' }) })), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxs(Fragment, { children: [jsx(Typography, Object.assign({ className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true }, { children: ens === null || ens === void 0 ? void 0 : ens.name })), jsx("div", { className: 'wallet__row__seperator' }), jsx(Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: shortenWalletAddress(walletPublicKey, 3, 3) }))] })) : (jsx(Typography, Object.assign({ variant: 'body_small', color: 'primary' }, { children: shortenWalletAddress(walletPublicKey, 4, 4) })))] })), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, title: 'Wallet options', buttonClassName: 'wallet__menu' })] })));
78
+ return (jsxs("div", Object.assign({ className: 'wallet__container', "data-testid": 'wallet' }, { children: [jsxs("div", Object.assign({ className: 'wallet__row' }, { children: [jsx("div", Object.assign({ className: 'wallet__icon-container' }, { children: jsx(WalletIconWithStatus, { iconSize: iconSize, walletName: connector.name, connected: connected, variant: 'secondary' }) })), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxs(Fragment, { children: [jsx(Typography, Object.assign({ className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true }, { children: ens === null || ens === void 0 ? void 0 : ens.name })), jsx("div", { className: 'wallet__row__seperator' }), jsx(Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: shortenWalletAddress(address, 3, 3) }))] })) : (jsx(Typography, Object.assign({ variant: 'body_small', color: 'primary' }, { children: shortenWalletAddress(address, 4, 4) })))] })), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, title: 'Wallet options', buttonClassName: 'wallet__menu' })] })));
82
79
  };
83
80
 
84
81
  export { Wallet };
@@ -41,8 +41,6 @@ const DynamicWidgetContextProvider = ({ children, }) => {
41
41
  const inlineControlsRef = React.useRef(null);
42
42
  const availableWalletsContainerRef = React.useRef(null);
43
43
  const { setShowDynamicUserProfile, showDynamicUserProfile } = useInternalDynamicContext.useInternalDynamicContext();
44
- const [newWalletId, setNewWalletId] = React.useState('');
45
- const [walletIdToUnlink, setWalletIdToUnlink] = React.useState(undefined);
46
44
  const isKYCEnabled = useKYCFlag.useKYCFlag();
47
45
  const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
48
46
  const initialView = React.useMemo(() => (isKYCEnabled && !isMultiWalletEnabled ? 'profile' : 'index'), [isKYCEnabled, isMultiWalletEnabled]);
@@ -72,20 +70,14 @@ const DynamicWidgetContextProvider = ({ children, }) => {
72
70
  goToProfileView,
73
71
  inlineControlsRef,
74
72
  isOpen: showDynamicUserProfile,
75
- newWalletId,
76
73
  setDynamicWidgetView,
77
74
  setIsOpen: setShowDynamicUserProfile,
78
- setNewWalletId,
79
- setWalletIdToUnlink,
80
- walletIdToUnlink,
81
75
  widgetRef,
82
76
  }), [
83
77
  dynamicWidgetView,
84
78
  goToProfileView,
85
- newWalletId,
86
79
  setShowDynamicUserProfile,
87
80
  showDynamicUserProfile,
88
- walletIdToUnlink,
89
81
  ]);
90
82
  return (jsxRuntime.jsx(DynamicWidgetContext.Provider, Object.assign({ value: value }, { children: children })));
91
83
  };
@@ -5,12 +5,8 @@ export interface WidgetContextProps {
5
5
  goToProfileView: () => void;
6
6
  inlineControlsRef: RefObject<HTMLDivElement>;
7
7
  isOpen: boolean;
8
- newWalletId: string;
9
8
  setDynamicWidgetView: Dispatch<SetStateAction<DynamicWidgetViews>>;
10
9
  setIsOpen: Dispatch<SetStateAction<boolean>>;
11
- setNewWalletId: Dispatch<SetStateAction<string>>;
12
- setWalletIdToUnlink: Dispatch<SetStateAction<string | undefined>>;
13
- walletIdToUnlink?: string;
14
10
  widgetRef: RefObject<HTMLDivElement>;
15
11
  }
16
12
  export type DynamicWidgetViews = 'index' | 'profile' | 'edit-profile';
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { createContext, useRef, useState, useMemo, useCallback, useEffect, useContext } from 'react';
2
+ import { createContext, useRef, useMemo, useState, useCallback, useEffect, useContext } from 'react';
3
3
  import '@dynamic-labs/utils';
4
4
  import '@dynamic-labs/sdk-api';
5
5
  import '../../../config/ApiEndpoint.js';
@@ -37,8 +37,6 @@ const DynamicWidgetContextProvider = ({ children, }) => {
37
37
  const inlineControlsRef = useRef(null);
38
38
  const availableWalletsContainerRef = useRef(null);
39
39
  const { setShowDynamicUserProfile, showDynamicUserProfile } = useInternalDynamicContext();
40
- const [newWalletId, setNewWalletId] = useState('');
41
- const [walletIdToUnlink, setWalletIdToUnlink] = useState(undefined);
42
40
  const isKYCEnabled = useKYCFlag();
43
41
  const isMultiWalletEnabled = useMultiWalletFlag();
44
42
  const initialView = useMemo(() => (isKYCEnabled && !isMultiWalletEnabled ? 'profile' : 'index'), [isKYCEnabled, isMultiWalletEnabled]);
@@ -68,20 +66,14 @@ const DynamicWidgetContextProvider = ({ children, }) => {
68
66
  goToProfileView,
69
67
  inlineControlsRef,
70
68
  isOpen: showDynamicUserProfile,
71
- newWalletId,
72
69
  setDynamicWidgetView,
73
70
  setIsOpen: setShowDynamicUserProfile,
74
- setNewWalletId,
75
- setWalletIdToUnlink,
76
- walletIdToUnlink,
77
71
  widgetRef,
78
72
  }), [
79
73
  dynamicWidgetView,
80
74
  goToProfileView,
81
- newWalletId,
82
75
  setShowDynamicUserProfile,
83
76
  showDynamicUserProfile,
84
- walletIdToUnlink,
85
77
  ]);
86
78
  return (jsx(DynamicWidgetContext.Provider, Object.assign({ value: value }, { children: children })));
87
79
  };
@@ -20,7 +20,7 @@ const useFetchChain = (connector) => {
20
20
  name: chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.displayName,
21
21
  };
22
22
  /* istanbul ignore else */
23
- if (chainId) {
23
+ if (chainId && connector.evmNetworks) {
24
24
  const result = connector.evmNetworks.find((element) => element.chainId === chainId);
25
25
  chainWithIcon.name = (_a = result === null || result === void 0 ? void 0 : result.vanityName) !== null && _a !== void 0 ? _a : chainWithIcon.name;
26
26
  chainWithIcon.icon = result === null || result === void 0 ? void 0 : result.iconUrls[0];
@@ -16,7 +16,7 @@ const useFetchChain = (connector) => {
16
16
  name: chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.displayName,
17
17
  };
18
18
  /* istanbul ignore else */
19
- if (chainId) {
19
+ if (chainId && connector.evmNetworks) {
20
20
  const result = connector.evmNetworks.find((element) => element.chainId === chainId);
21
21
  chainWithIcon.name = (_a = result === null || result === void 0 ? void 0 : result.vanityName) !== null && _a !== void 0 ? _a : chainWithIcon.name;
22
22
  chainWithIcon.icon = result === null || result === void 0 ? void 0 : result.iconUrls[0];
@@ -38,7 +38,7 @@ require('../../../../components/Alert/Alert.cjs');
38
38
  require('../../../../components/Popper/Popper/Popper.cjs');
39
39
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
40
40
 
41
- const DetectedKnownSecondaryWalletModal = ({ setNewWalletId, }) => {
41
+ const DetectedKnownSecondaryWalletModal = ({ setSelectedWalletWithAction, }) => {
42
42
  const { setMultiWalletWidgetState, primaryWallet, secondaryWallets, setPrimaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
43
43
  const handleButtonClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
44
44
  const publicAddress = yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.fetchPublicAddress());
@@ -50,7 +50,7 @@ const DetectedKnownSecondaryWalletModal = ({ setNewWalletId, }) => {
50
50
  return;
51
51
  }
52
52
  setMultiWalletWidgetState('idle');
53
- setNewWalletId(wallet.id);
53
+ setSelectedWalletWithAction({ action: 'select', wallet });
54
54
  setPrimaryWallet(wallet.id);
55
55
  });
56
56
  return (jsxRuntime.jsx(WidgetPortal.WidgetPortal, Object.assign({ onBackdropClick: handleButtonClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'detected-known-secondary-wallet-modal__content' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', variant: 'body_normal' }, { children: "Account Change Detected" })), jsxRuntime.jsx(promptAccountSwitch.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: `Your active account in ${primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name} has changed. We’re updating the primary account here to match your wallet status.` })), jsxRuntime.jsx(Button.Button, Object.assign({ onClick: handleButtonClick, buttonVariant: 'primary', expanded: true, buttonRounded: 'default', typographyProps: {
@@ -1,6 +1,7 @@
1
- import { SetStateAction, Dispatch } from 'react';
1
+ /// <reference types="react" />
2
+ import { WalletWithAction } from '../../../../shared';
2
3
  type Props = {
3
- setNewWalletId: Dispatch<SetStateAction<string>>;
4
+ setSelectedWalletWithAction(walletWithAction: WalletWithAction | null): void;
4
5
  };
5
- export declare const DetectedKnownSecondaryWalletModal: ({ setNewWalletId, }: Props) => JSX.Element;
6
+ export declare const DetectedKnownSecondaryWalletModal: ({ setSelectedWalletWithAction, }: Props) => JSX.Element;
6
7
  export {};
@@ -34,7 +34,7 @@ import '../../../../components/Alert/Alert.js';
34
34
  import '../../../../components/Popper/Popper/Popper.js';
35
35
  import '../../../../components/Popper/PopperContext/PopperContext.js';
36
36
 
37
- const DetectedKnownSecondaryWalletModal = ({ setNewWalletId, }) => {
37
+ const DetectedKnownSecondaryWalletModal = ({ setSelectedWalletWithAction, }) => {
38
38
  const { setMultiWalletWidgetState, primaryWallet, secondaryWallets, setPrimaryWallet, } = useInternalDynamicContext();
39
39
  const handleButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const publicAddress = yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.fetchPublicAddress());
@@ -46,7 +46,7 @@ const DetectedKnownSecondaryWalletModal = ({ setNewWalletId, }) => {
46
46
  return;
47
47
  }
48
48
  setMultiWalletWidgetState('idle');
49
- setNewWalletId(wallet.id);
49
+ setSelectedWalletWithAction({ action: 'select', wallet });
50
50
  setPrimaryWallet(wallet.id);
51
51
  });
52
52
  return (jsx(WidgetPortal, Object.assign({ onBackdropClick: handleButtonClick }, { children: jsxs("div", Object.assign({ className: 'detected-known-secondary-wallet-modal__content' }, { children: [jsx(Typography, Object.assign({ color: 'primary', variant: 'body_normal' }, { children: "Account Change Detected" })), jsx(SvgPromptAccountSwitch, {}), jsx(Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: `Your active account in ${primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name} has changed. We’re updating the primary account here to match your wallet status.` })), jsx(Button, Object.assign({ onClick: handleButtonClick, buttonVariant: 'primary', expanded: true, buttonRounded: 'default', typographyProps: {
@@ -6,7 +6,6 @@ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
8
8
  var LoadingContext = require('../../../../context/LoadingContext/LoadingContext.cjs');
9
- var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
10
9
  var WidgetPortal = require('../../components/WidgetPortal/WidgetPortal.cjs');
11
10
  require('react');
12
11
  var Typography = require('../../../../components/Typography/Typography.cjs');
@@ -40,15 +39,14 @@ require('../../../../components/Popper/Popper/Popper.cjs');
40
39
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
41
40
 
42
41
  const UnlinkWalletPopUp = ({ walletId }) => {
43
- const { setWalletIdToUnlink } = DynamicWidgetContext.useWidgetContext();
44
- const { handleUnlinkWallet, eventsCallbacks, user } = useInternalDynamicContext.useInternalDynamicContext();
42
+ const { handleUnlinkWallet, eventsCallbacks, setSelectedWalletWithAction, user, } = useInternalDynamicContext.useInternalDynamicContext();
45
43
  const { loading, setLoading } = LoadingContext.useLoadingContext();
46
44
  const onConfirmClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
47
45
  var _a;
48
46
  try {
49
47
  setLoading(true);
50
48
  yield handleUnlinkWallet(walletId);
51
- setWalletIdToUnlink(undefined);
49
+ setSelectedWalletWithAction(null);
52
50
  const walletFromId = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((wallet) => wallet.id === walletId);
53
51
  if (walletFromId) {
54
52
  (_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUnlinkSuccess) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, walletFromId);
@@ -62,7 +60,7 @@ const UnlinkWalletPopUp = ({ walletId }) => {
62
60
  }
63
61
  });
64
62
  const onCancelClick = () => {
65
- setWalletIdToUnlink(undefined);
63
+ setSelectedWalletWithAction(null);
66
64
  };
67
65
  return (jsxRuntime.jsx(WidgetPortal.WidgetPortal, Object.assign({ onBackdropClick: onCancelClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'unlink-wallet-popup__container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', className: 'unlink-wallet-popup__title', variant: 'body_normal', as: 'h6' }, { children: "Unlink your wallet?" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'unlink-wallet-popup__label', variant: 'body_small', color: 'secondary' }, { children: "Are you sure you want to unlink your wallet?" })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonPadding: 'small', onClick: onConfirmClick, disabled: loading, buttonClassName: 'unlink-wallet-popup__button unlink-wallet-popup__button--shadow', color: 'primary', expanded: true, buttonRounded: 'small', typographyProps: {
68
66
  variant: 'button_secondary',
@@ -2,7 +2,6 @@ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
4
4
  import { useLoadingContext } from '../../../../context/LoadingContext/LoadingContext.js';
5
- import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
6
5
  import { WidgetPortal } from '../../components/WidgetPortal/WidgetPortal.js';
7
6
  import 'react';
8
7
  import { Typography } from '../../../../components/Typography/Typography.js';
@@ -36,15 +35,14 @@ import '../../../../components/Popper/Popper/Popper.js';
36
35
  import '../../../../components/Popper/PopperContext/PopperContext.js';
37
36
 
38
37
  const UnlinkWalletPopUp = ({ walletId }) => {
39
- const { setWalletIdToUnlink } = useWidgetContext();
40
- const { handleUnlinkWallet, eventsCallbacks, user } = useInternalDynamicContext();
38
+ const { handleUnlinkWallet, eventsCallbacks, setSelectedWalletWithAction, user, } = useInternalDynamicContext();
41
39
  const { loading, setLoading } = useLoadingContext();
42
40
  const onConfirmClick = () => __awaiter(void 0, void 0, void 0, function* () {
43
41
  var _a;
44
42
  try {
45
43
  setLoading(true);
46
44
  yield handleUnlinkWallet(walletId);
47
- setWalletIdToUnlink(undefined);
45
+ setSelectedWalletWithAction(null);
48
46
  const walletFromId = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((wallet) => wallet.id === walletId);
49
47
  if (walletFromId) {
50
48
  (_a = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUnlinkSuccess) === null || _a === void 0 ? void 0 : _a.call(eventsCallbacks, walletFromId);
@@ -58,7 +56,7 @@ const UnlinkWalletPopUp = ({ walletId }) => {
58
56
  }
59
57
  });
60
58
  const onCancelClick = () => {
61
- setWalletIdToUnlink(undefined);
59
+ setSelectedWalletWithAction(null);
62
60
  };
63
61
  return (jsx(WidgetPortal, Object.assign({ onBackdropClick: onCancelClick }, { children: jsxs("div", Object.assign({ className: 'unlink-wallet-popup__container' }, { children: [jsx(Typography, Object.assign({ color: 'primary', className: 'unlink-wallet-popup__title', variant: 'body_normal', as: 'h6' }, { children: "Unlink your wallet?" })), jsx(Typography, Object.assign({ className: 'unlink-wallet-popup__label', variant: 'body_small', color: 'secondary' }, { children: "Are you sure you want to unlink your wallet?" })), jsx(Button, Object.assign({ buttonPadding: 'small', onClick: onConfirmClick, disabled: loading, buttonClassName: 'unlink-wallet-popup__button unlink-wallet-popup__button--shadow', color: 'primary', expanded: true, buttonRounded: 'small', typographyProps: {
64
62
  variant: 'button_secondary',
@@ -44,13 +44,13 @@ var useUserDataForm = require('../../../../utils/hooks/useUserDataForm/useUserDa
44
44
  var index = require('../../../../views/CollectUserDataView/UserDataFields/index.cjs');
45
45
  var DynamicWidgetFooter = require('../../components/DynamicWidgetFooter/DynamicWidgetFooter.cjs');
46
46
  var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
47
- var getEnabledUserProfileFields = require('../../../../utils/functions/getEnabledUserProfileFields/getEnabledUserProfileFields.cjs');
47
+ var getUserProfileFields = require('../../../../utils/functions/getUserProfileFields/getUserProfileFields.cjs');
48
48
 
49
49
  const EditProfileView = ({ rootClassName, }) => {
50
50
  const { setView } = ViewContext.useViewContext();
51
51
  const { projectSettings, setShowAuthFlow, user } = useInternalDynamicContext.useInternalDynamicContext();
52
52
  const { goToProfileView } = DynamicWidgetContext.useWidgetContext();
53
- const userFields = getEnabledUserProfileFields.getUserProfileFields({
53
+ const allUserFields = getUserProfileFields.getUserProfileFields({
54
54
  projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
55
55
  user,
56
56
  });
@@ -66,14 +66,14 @@ const EditProfileView = ({ rootClassName, }) => {
66
66
  }
67
67
  }), [goToProfileView, setShowAuthFlow, setView, updateUser]);
68
68
  const { fetch, formikInitialValues, formikValidationSchema, onFormSubmit } = useUserDataForm.useUserDataForm({
69
- fields: userFields,
69
+ fields: allUserFields,
70
70
  onSubmit: onEditProfileFormSubmit,
71
71
  shouldEnforcePolicies: false,
72
72
  userProfile: user,
73
73
  });
74
74
  const isKYCEnabled = useKYCFlag.useKYCFlag();
75
75
  const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
76
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My profile" }))), jsxRuntime.jsx(formik.Formik, Object.assign({ onSubmit: onFormSubmit, initialValues: formikInitialValues, validationSchema: formikValidationSchema, validateOnChange: true }, { children: ({ errors, touched, isSubmitting, isValid, dirty }) => (jsxRuntime.jsxs(formik.Form, Object.assign({ className: classNames.classNames('dynamic-widget-edit-profile-view', rootClassName), "data-testid": 'editUserProfileForm' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields' }, { children: jsxRuntime.jsx(index.UserDataFields, { errors: errors, fields: userFields, touched: touched }) })), jsxRuntime.jsxs(DynamicWidgetFooter.DynamicWidgetFooter, { children: [jsxRuntime.jsx(Button.Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: goToProfileView }, { children: "Cancel" })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', disabled: fetch || !isValid || !dirty, buttonRounded: 'small', expanded: true, type: 'submit', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, loading: isSubmitting, startSlot: jsxRuntime.jsx(check.ReactComponent, {}) }, { children: "Save" }))] })] }))) }))] }));
76
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My profile" }))), jsxRuntime.jsx(formik.Formik, Object.assign({ onSubmit: onFormSubmit, initialValues: formikInitialValues, validationSchema: formikValidationSchema, validateOnChange: true }, { children: ({ errors, touched, isSubmitting, isValid, dirty }) => (jsxRuntime.jsxs(formik.Form, Object.assign({ className: classNames.classNames('dynamic-widget-edit-profile-view', rootClassName), "data-testid": 'editUserProfileForm' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields' }, { children: jsxRuntime.jsx(index.UserDataFields, { errors: errors, fields: allUserFields, touched: touched }) })), jsxRuntime.jsxs(DynamicWidgetFooter.DynamicWidgetFooter, { children: [jsxRuntime.jsx(Button.Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: goToProfileView }, { children: "Cancel" })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', disabled: fetch || !isValid || !dirty, buttonRounded: 'small', expanded: true, type: 'submit', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, loading: isSubmitting, startSlot: jsxRuntime.jsx(check.ReactComponent, {}) }, { children: "Save" }))] })] }))) }))] }));
77
77
  };
78
78
 
79
79
  exports.EditProfileView = EditProfileView;
@@ -40,13 +40,13 @@ import { useUserDataForm } from '../../../../utils/hooks/useUserDataForm/useUser
40
40
  import { UserDataFields } from '../../../../views/CollectUserDataView/UserDataFields/index.js';
41
41
  import { DynamicWidgetFooter } from '../../components/DynamicWidgetFooter/DynamicWidgetFooter.js';
42
42
  import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
43
- import { getUserProfileFields } from '../../../../utils/functions/getEnabledUserProfileFields/getEnabledUserProfileFields.js';
43
+ import { getUserProfileFields } from '../../../../utils/functions/getUserProfileFields/getUserProfileFields.js';
44
44
 
45
45
  const EditProfileView = ({ rootClassName, }) => {
46
46
  const { setView } = useViewContext();
47
47
  const { projectSettings, setShowAuthFlow, user } = useInternalDynamicContext();
48
48
  const { goToProfileView } = useWidgetContext();
49
- const userFields = getUserProfileFields({
49
+ const allUserFields = getUserProfileFields({
50
50
  projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
51
51
  user,
52
52
  });
@@ -62,14 +62,14 @@ const EditProfileView = ({ rootClassName, }) => {
62
62
  }
63
63
  }), [goToProfileView, setShowAuthFlow, setView, updateUser]);
64
64
  const { fetch, formikInitialValues, formikValidationSchema, onFormSubmit } = useUserDataForm({
65
- fields: userFields,
65
+ fields: allUserFields,
66
66
  onSubmit: onEditProfileFormSubmit,
67
67
  shouldEnforcePolicies: false,
68
68
  userProfile: user,
69
69
  });
70
70
  const isKYCEnabled = useKYCFlag();
71
71
  const isMultiWalletEnabled = useMultiWalletFlag();
72
- return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My profile" }))), jsx(Formik, Object.assign({ onSubmit: onFormSubmit, initialValues: formikInitialValues, validationSchema: formikValidationSchema, validateOnChange: true }, { children: ({ errors, touched, isSubmitting, isValid, dirty }) => (jsxs(Form, Object.assign({ className: classNames('dynamic-widget-edit-profile-view', rootClassName), "data-testid": 'editUserProfileForm' }, { children: [jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields' }, { children: jsx(UserDataFields, { errors: errors, fields: userFields, touched: touched }) })), jsxs(DynamicWidgetFooter, { children: [jsx(Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: goToProfileView }, { children: "Cancel" })), jsx(Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', disabled: fetch || !isValid || !dirty, buttonRounded: 'small', expanded: true, type: 'submit', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, loading: isSubmitting, startSlot: jsx(SvgCheck, {}) }, { children: "Save" }))] })] }))) }))] }));
72
+ return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My profile" }))), jsx(Formik, Object.assign({ onSubmit: onFormSubmit, initialValues: formikInitialValues, validationSchema: formikValidationSchema, validateOnChange: true }, { children: ({ errors, touched, isSubmitting, isValid, dirty }) => (jsxs(Form, Object.assign({ className: classNames('dynamic-widget-edit-profile-view', rootClassName), "data-testid": 'editUserProfileForm' }, { children: [jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields' }, { children: jsx(UserDataFields, { errors: errors, fields: allUserFields, touched: touched }) })), jsxs(DynamicWidgetFooter, { children: [jsx(Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: goToProfileView }, { children: "Cancel" })), jsx(Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', disabled: fetch || !isValid || !dirty, buttonRounded: 'small', expanded: true, type: 'submit', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, loading: isSubmitting, startSlot: jsx(SvgCheck, {}) }, { children: "Save" }))] })] }))) }))] }));
73
73
  };
74
74
 
75
75
  export { EditProfileView };
@@ -29,7 +29,7 @@ require('../../../../components/Transition/OpacityTransition/OpacityTransition.c
29
29
  require('../../../../config/ApiEndpoint.cjs');
30
30
  require('@dynamic-labs/rpc-providers');
31
31
  require('../../../../context/ErrorContext/ErrorContext.cjs');
32
- var getEnabledUserProfileFields = require('../../../../utils/functions/getEnabledUserProfileFields/getEnabledUserProfileFields.cjs');
32
+ var getUserProfileFields = require('../../../../utils/functions/getUserProfileFields/getUserProfileFields.cjs');
33
33
  require('../../../../context/MockContext/MockContext.cjs');
34
34
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
35
35
  require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
@@ -44,7 +44,8 @@ var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
44
44
  const ProfileView = () => {
45
45
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
46
46
  const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
47
- const editableUserFields = getEnabledUserProfileFields.getEditableUserProfileFields(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc);
47
+ // Allow to navigate to edit profile view when there are fields what can be edited
48
+ const editableUserFields = getUserProfileFields.getEditableUserProfileFields(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc);
48
49
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(UserProfile.UserProfile, { rootClassName: 'profile-view' }), jsxRuntime.jsx(DynamicWidgetFooter.DynamicWidgetFooter, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'profile-view__footer' }, { children: [editableUserFields.length > 0 && (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', typographyProps: {
49
50
  color: 'secondary',
50
51
  variant: 'button_tertiary',
@@ -25,7 +25,7 @@ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js
25
25
  import '../../../../config/ApiEndpoint.js';
26
26
  import '@dynamic-labs/rpc-providers';
27
27
  import '../../../../context/ErrorContext/ErrorContext.js';
28
- import { getEditableUserProfileFields } from '../../../../utils/functions/getEnabledUserProfileFields/getEnabledUserProfileFields.js';
28
+ import { getEditableUserProfileFields } from '../../../../utils/functions/getUserProfileFields/getUserProfileFields.js';
29
29
  import '../../../../context/MockContext/MockContext.js';
30
30
  import '../../../../context/CaptchaContext/CaptchaContext.js';
31
31
  import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
@@ -40,6 +40,7 @@ import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
40
40
  const ProfileView = () => {
41
41
  const { setDynamicWidgetView } = useWidgetContext();
42
42
  const { projectSettings } = useInternalDynamicContext();
43
+ // Allow to navigate to edit profile view when there are fields what can be edited
43
44
  const editableUserFields = getEditableUserProfileFields(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc);
44
45
  return (jsxs(Fragment, { children: [jsx(UserProfile, { rootClassName: 'profile-view' }), jsx(DynamicWidgetFooter, { children: jsxs("div", Object.assign({ className: 'profile-view__footer' }, { children: [editableUserFields.length > 0 && (jsx(Button, Object.assign({ buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', typographyProps: {
45
46
  color: 'secondary',