@dynamic-labs/sdk-react-core 0.19.0-alpha.0 → 0.19.0-alpha.1

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 (131) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.cjs +3 -3
  3. package/package.js +3 -3
  4. package/package.json +11 -10
  5. package/src/index.cjs +2 -0
  6. package/src/index.js +1 -0
  7. package/src/lib/Main.cjs +5 -0
  8. package/src/lib/Main.js +5 -0
  9. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +9 -6
  10. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +9 -6
  11. package/src/lib/components/Button/Button.cjs +10 -7
  12. package/src/lib/components/Button/Button.d.ts +3 -3
  13. package/src/lib/components/Button/Button.js +10 -7
  14. package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
  15. package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
  16. package/src/lib/components/Icon/Icon.cjs +1 -0
  17. package/src/lib/components/Icon/Icon.js +1 -0
  18. package/src/lib/components/Icon/Icon.types.d.ts +1 -1
  19. package/src/lib/components/IconWithSpinner/IconWithSpinner.d.ts +1 -1
  20. package/src/lib/components/ListTile/ListTile.cjs +1 -1
  21. package/src/lib/components/ListTile/ListTile.js +1 -1
  22. package/src/lib/components/ListTile/ListTile.types.d.ts +1 -0
  23. package/src/lib/components/ModalHeader/ModalHeader.cjs +2 -2
  24. package/src/lib/components/ModalHeader/ModalHeader.js +2 -2
  25. package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +2 -1
  26. package/src/lib/components/NetworkPicker/NetworkPicker.cjs +1 -1
  27. package/src/lib/components/NetworkPicker/NetworkPicker.js +1 -1
  28. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +5 -3
  29. package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -0
  30. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +5 -3
  31. package/src/lib/components/PoweredByDynamic/PoweredByDynamic.cjs +6 -2
  32. package/src/lib/components/PoweredByDynamic/PoweredByDynamic.d.ts +1 -0
  33. package/src/lib/components/PoweredByDynamic/PoweredByDynamic.js +6 -2
  34. package/src/lib/components/UserProfileForm/UserProfileForm.cjs +26 -14
  35. package/src/lib/components/UserProfileForm/UserProfileForm.d.ts +14 -3
  36. package/src/lib/components/UserProfileForm/UserProfileForm.js +27 -15
  37. package/src/lib/components/UserProfileForm/index.d.ts +1 -0
  38. package/src/lib/context/DynamicContext/DynamicContext.cjs +9 -3
  39. package/src/lib/context/DynamicContext/DynamicContext.js +10 -4
  40. package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
  41. package/src/lib/data/api.cjs +16 -0
  42. package/src/lib/data/api.d.ts +1 -0
  43. package/src/lib/data/api.js +18 -3
  44. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +10 -2
  45. package/src/lib/layout/DynamicAuthLayout/Header/header.js +10 -2
  46. package/src/lib/shared/assets/double-arrow-right.cjs +53 -0
  47. package/src/lib/shared/assets/double-arrow-right.js +29 -0
  48. package/src/lib/shared/assets/index.d.ts +1 -0
  49. package/src/lib/styles/index.shadow.cjs +1 -1
  50. package/src/lib/styles/index.shadow.js +1 -1
  51. package/src/lib/utils/constants/index.d.ts +1 -1
  52. package/src/lib/utils/constants/localStorage.cjs +3 -1
  53. package/src/lib/utils/constants/localStorage.d.ts +1 -0
  54. package/src/lib/utils/constants/localStorage.js +3 -2
  55. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.cjs +14 -2
  56. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.d.ts +3 -2
  57. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.js +14 -2
  58. package/src/lib/utils/functions/getUserProfileFields/index.d.ts +1 -0
  59. package/src/lib/utils/functions/index.d.ts +2 -0
  60. package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
  61. package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
  62. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +6 -4
  63. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +3 -1
  64. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +6 -4
  65. package/src/lib/utils/hooks/index.d.ts +4 -1
  66. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +19 -3
  67. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
  68. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +20 -4
  69. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
  70. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
  71. package/src/lib/utils/hooks/useFindSocialIcon/index.d.ts +1 -0
  72. package/src/lib/utils/hooks/{useGetSocialIcon/useGetSocialIcon.cjs → useFindSocialIcon/useFindSocialIcon.cjs} +3 -3
  73. package/src/lib/utils/hooks/useFindSocialIcon/useFindSocialIcon.d.ts +3 -0
  74. package/src/lib/utils/hooks/useFindSocialIcon/useFindSocialIcon.js +10 -0
  75. package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
  76. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +61 -0
  77. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +20 -0
  78. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +57 -0
  79. package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
  80. package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
  81. package/src/lib/utils/hooks/useWalletConnectorEvent/index.d.ts +1 -0
  82. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +42 -0
  83. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.d.ts +12 -0
  84. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +38 -0
  85. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +12 -0
  86. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +12 -0
  87. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +91 -136
  88. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +92 -137
  89. package/src/lib/views/AccountExistsView/AccountExistsView.cjs +3 -3
  90. package/src/lib/views/AccountExistsView/AccountExistsView.js +3 -3
  91. package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +4 -0
  92. package/src/lib/views/CollectUserDataView/UserDataFields/index.js +4 -0
  93. package/src/lib/views/EmailUpdate/EmailUpdate.cjs +8 -2
  94. package/src/lib/views/EmailUpdate/EmailUpdate.js +8 -2
  95. package/src/lib/views/EmailVerification/EmailVerification.cjs +13 -4
  96. package/src/lib/views/EmailVerification/EmailVerification.js +15 -6
  97. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +3 -2
  98. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +3 -2
  99. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +5 -3
  100. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +6 -4
  101. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +3 -3
  102. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +3 -3
  103. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +107 -0
  104. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +2 -0
  105. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +103 -0
  106. package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
  107. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +13 -3
  108. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +13 -3
  109. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +14 -4
  110. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +14 -4
  111. package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +3 -3
  112. package/src/lib/views/SocialRedirectView/SocialRedirectView.js +3 -3
  113. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +3 -3
  114. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +3 -3
  115. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.cjs +2 -8
  116. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +3 -9
  117. package/src/lib/views/viewToComponentMap.cjs +2 -0
  118. package/src/lib/views/viewToComponentMap.js +2 -0
  119. package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +1 -1
  120. package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +1 -1
  121. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -1
  122. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -1
  123. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.cjs +1 -1
  124. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.js +1 -1
  125. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -1
  126. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -1
  127. package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +1 -1
  128. package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +1 -1
  129. package/src/lib/utils/hooks/useGetSocialIcon/index.d.ts +0 -1
  130. package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.d.ts +0 -2
  131. package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.js +0 -10
@@ -8,19 +8,23 @@ var Typography = require('../Typography/Typography.cjs');
8
8
  require('react');
9
9
  var dynamicLogo = require('../../assets/dynamic-logo.cjs');
10
10
  var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
11
+ var DynamicWidgetFooter = require('../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.cjs');
11
12
 
12
13
  const URL = 'https://dynamic.xyz';
13
14
  const alignClassNames = {
14
15
  center: 'powered-by-dynamic--center',
15
16
  right: 'powered-by-dynamic--right',
16
17
  };
17
- const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, }) => {
18
+ const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, asFooter, }) => {
18
19
  var _a;
19
20
  const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
20
21
  if (((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.displayDynamicMessaging) === false) {
21
22
  return null;
22
23
  }
23
- return (jsxRuntime.jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames.classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames.classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsxRuntime.jsx(dynamicLogo.ReactComponent, { className: classNames.classNames('powered-by-dynamic__logo', classNameLogo) })] })));
24
+ const content = (jsxRuntime.jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames.classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames.classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsxRuntime.jsx(dynamicLogo.ReactComponent, { className: classNames.classNames('powered-by-dynamic__logo', classNameLogo) })] })));
25
+ if (asFooter)
26
+ return jsxRuntime.jsx(DynamicWidgetFooter.DynamicWidgetFooter, { children: content });
27
+ return content;
24
28
  };
25
29
 
26
30
  exports.PoweredByDynamic = PoweredByDynamic;
@@ -4,6 +4,7 @@ type PoweredByDynamicProps = {
4
4
  classNameLogo?: string;
5
5
  classNameRoot?: string;
6
6
  classNameText?: string;
7
+ asFooter?: boolean;
7
8
  };
8
9
  export declare const PoweredByDynamic: React.FC<PoweredByDynamicProps>;
9
10
  export {};
@@ -4,19 +4,23 @@ import { Typography } from '../Typography/Typography.js';
4
4
  import 'react';
5
5
  import { ReactComponent as SvgDynamicLogo } from '../../assets/dynamic-logo.js';
6
6
  import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
7
+ import { DynamicWidgetFooter } from '../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.js';
7
8
 
8
9
  const URL = 'https://dynamic.xyz';
9
10
  const alignClassNames = {
10
11
  center: 'powered-by-dynamic--center',
11
12
  right: 'powered-by-dynamic--right',
12
13
  };
13
- const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, }) => {
14
+ const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, asFooter, }) => {
14
15
  var _a;
15
16
  const { projectSettings } = useInternalDynamicContext();
16
17
  if (((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.displayDynamicMessaging) === false) {
17
18
  return null;
18
19
  }
19
- return (jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsx(Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsx(SvgDynamicLogo, { className: classNames('powered-by-dynamic__logo', classNameLogo) })] })));
20
+ const content = (jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsx(Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsx(SvgDynamicLogo, { className: classNames('powered-by-dynamic__logo', classNameLogo) })] })));
21
+ if (asFooter)
22
+ return jsx(DynamicWidgetFooter, { children: content });
23
+ return content;
20
24
  };
21
25
 
22
26
  export { PoweredByDynamic };
@@ -3,20 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
6
7
  var formik = require('formik');
7
8
  var useUserDataForm = require('../../utils/hooks/useUserDataForm/useUserDataForm.cjs');
8
- var getUserProfileFields = require('../../utils/functions/getUserProfileFields/getUserProfileFields.cjs');
9
- var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
10
- var classNames = require('../../utils/functions/classNames/classNames.cjs');
11
- var index = require('../../views/CollectUserDataView/UserDataFields/index.cjs');
12
- var DynamicWidgetFooter = require('../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.cjs');
13
- var Button = require('../Button/Button.cjs');
14
9
  require('@dynamic-labs/sdk-api');
15
10
  require('../../shared/logger.cjs');
16
11
  require('@dynamic-labs/iconic');
17
12
  require('@dynamic-labs/wallet-connector-core');
18
13
  require('../../context/ViewContext/ViewContext.cjs');
19
- require('react');
20
14
  var check = require('../../shared/assets/check.cjs');
21
15
  require('@dynamic-labs/wallet-book');
22
16
  require('@dynamic-labs/utils');
@@ -24,20 +18,38 @@ require('../../utils/constants/colors.cjs');
24
18
  require('../../shared/utils/classes/storage/localStorage.cjs');
25
19
  require('ethers');
26
20
  require('../../shared/consts/index.cjs');
21
+ require('@dynamic-labs/multi-wallet');
22
+ var getUserProfileFields = require('../../utils/functions/getUserProfileFields/getUserProfileFields.cjs');
23
+ var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
24
+ var classNames = require('../../utils/functions/classNames/classNames.cjs');
25
+ var index = require('../../views/CollectUserDataView/UserDataFields/index.cjs');
26
+ var DynamicWidgetFooter = require('../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.cjs');
27
+ var Button = require('../Button/Button.cjs');
27
28
 
28
- const UserProfileForm = ({ formClassName, onEditProfileSubmit, onEditProfileCancel, options = { shouldEnforcePolicies: false }, }) => {
29
+ const UserProfileForm = ({ filterFields, formClassName, fieldsContainerStyle, onEditProfileSubmit, onEditProfileCancel, options = {
30
+ buttonsAsFooter: true,
31
+ cancelText: 'Cancel',
32
+ shouldEnforcePolicies: false,
33
+ submitText: 'Save',
34
+ }, }) => {
29
35
  const { projectSettings, user } = useInternalDynamicContext.useInternalDynamicContext();
30
- const allUserFields = getUserProfileFields.getUserProfileFields({
31
- projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
32
- user,
33
- });
36
+ const targetFields = React.useMemo(() => {
37
+ const allUserFields = getUserProfileFields.getUserProfileFields({
38
+ projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
39
+ user,
40
+ });
41
+ if (!filterFields)
42
+ return allUserFields;
43
+ return allUserFields.filter(({ name }) => filterFields.includes(name));
44
+ }, [filterFields, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc, user]);
34
45
  const { fetch, formikInitialValues, formikValidationSchema, onFormSubmit } = useUserDataForm.useUserDataForm({
35
- fields: allUserFields,
46
+ fields: targetFields,
36
47
  onSubmit: onEditProfileSubmit,
37
48
  shouldEnforcePolicies: options.shouldEnforcePolicies,
38
49
  userProfile: user,
39
50
  });
40
- return (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', formClassName), "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: onEditProfileCancel }, { 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" }))] })] }))) })));
51
+ const makeButtonsContent = (isSubmitting, isValid, dirty) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!options.hideCancelButton && (jsxRuntime.jsx(Button.Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: onEditProfileCancel, dataTestId: 'cancel-button' }, options.cancelButtonProps, { children: options.cancelText }))), 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, {}), dataTestId: 'submit-button' }, options.submitButtonProps, { children: options.submitText }))] }));
52
+ return (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', formClassName), "data-testid": 'editUserProfileForm' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields', style: fieldsContainerStyle }, { children: jsxRuntime.jsx(index.UserDataFields, { errors: errors, fields: targetFields, touched: touched }) })), options.buttonsAsFooter ? (jsxRuntime.jsx(DynamicWidgetFooter.DynamicWidgetFooter, { children: makeButtonsContent(isSubmitting, isValid, dirty) })) : (makeButtonsContent(isSubmitting, isValid, dirty))] }))) })));
41
53
  };
42
54
 
43
55
  exports.UserProfileForm = UserProfileForm;
@@ -1,11 +1,22 @@
1
- import { FC } from 'react';
1
+ import { CSSProperties, FC } from 'react';
2
+ import { UserFields } from '@dynamic-labs/sdk-api';
2
3
  import { UserDataFormValues } from '../../utils/hooks/useUserDataForm/useUserDataForm';
4
+ import { ButtonProps } from '../Button/Button';
3
5
  export type UserProfileFormProps = {
6
+ onEditProfileSubmit?: (formValues: UserDataFormValues) => void;
7
+ onEditProfileCancel?: () => void;
8
+ /** Which fields should be made available for editing. Undefined means all */
9
+ filterFields?: (keyof UserFields)[];
4
10
  formClassName?: string;
5
- onEditProfileCancel: () => void;
6
- onEditProfileSubmit: (formValues: UserDataFormValues) => void;
11
+ fieldsContainerStyle?: CSSProperties;
7
12
  options?: {
8
13
  shouldEnforcePolicies?: boolean;
14
+ submitButtonProps?: ButtonProps;
15
+ cancelButtonProps?: ButtonProps;
16
+ hideCancelButton?: boolean;
17
+ buttonsAsFooter?: boolean;
18
+ submitText?: string;
19
+ cancelText?: string;
9
20
  };
10
21
  };
11
22
  export declare const UserProfileForm: FC<UserProfileFormProps>;
@@ -1,18 +1,12 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import { Formik, Form } from 'formik';
3
4
  import { useUserDataForm } from '../../utils/hooks/useUserDataForm/useUserDataForm.js';
4
- import { getUserProfileFields } from '../../utils/functions/getUserProfileFields/getUserProfileFields.js';
5
- import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
6
- import { classNames } from '../../utils/functions/classNames/classNames.js';
7
- import { UserDataFields } from '../../views/CollectUserDataView/UserDataFields/index.js';
8
- import { DynamicWidgetFooter } from '../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.js';
9
- import { Button } from '../Button/Button.js';
10
5
  import '@dynamic-labs/sdk-api';
11
6
  import '../../shared/logger.js';
12
7
  import '@dynamic-labs/iconic';
13
8
  import '@dynamic-labs/wallet-connector-core';
14
9
  import '../../context/ViewContext/ViewContext.js';
15
- import 'react';
16
10
  import { ReactComponent as SvgCheck } from '../../shared/assets/check.js';
17
11
  import '@dynamic-labs/wallet-book';
18
12
  import '@dynamic-labs/utils';
@@ -20,20 +14,38 @@ import '../../utils/constants/colors.js';
20
14
  import '../../shared/utils/classes/storage/localStorage.js';
21
15
  import 'ethers';
22
16
  import '../../shared/consts/index.js';
17
+ import '@dynamic-labs/multi-wallet';
18
+ import { getUserProfileFields } from '../../utils/functions/getUserProfileFields/getUserProfileFields.js';
19
+ import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
20
+ import { classNames } from '../../utils/functions/classNames/classNames.js';
21
+ import { UserDataFields } from '../../views/CollectUserDataView/UserDataFields/index.js';
22
+ import { DynamicWidgetFooter } from '../../widgets/DynamicWidget/components/DynamicWidgetFooter/DynamicWidgetFooter.js';
23
+ import { Button } from '../Button/Button.js';
23
24
 
24
- const UserProfileForm = ({ formClassName, onEditProfileSubmit, onEditProfileCancel, options = { shouldEnforcePolicies: false }, }) => {
25
+ const UserProfileForm = ({ filterFields, formClassName, fieldsContainerStyle, onEditProfileSubmit, onEditProfileCancel, options = {
26
+ buttonsAsFooter: true,
27
+ cancelText: 'Cancel',
28
+ shouldEnforcePolicies: false,
29
+ submitText: 'Save',
30
+ }, }) => {
25
31
  const { projectSettings, user } = useInternalDynamicContext();
26
- const allUserFields = getUserProfileFields({
27
- projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
28
- user,
29
- });
32
+ const targetFields = useMemo(() => {
33
+ const allUserFields = getUserProfileFields({
34
+ projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
35
+ user,
36
+ });
37
+ if (!filterFields)
38
+ return allUserFields;
39
+ return allUserFields.filter(({ name }) => filterFields.includes(name));
40
+ }, [filterFields, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc, user]);
30
41
  const { fetch, formikInitialValues, formikValidationSchema, onFormSubmit } = useUserDataForm({
31
- fields: allUserFields,
42
+ fields: targetFields,
32
43
  onSubmit: onEditProfileSubmit,
33
44
  shouldEnforcePolicies: options.shouldEnforcePolicies,
34
45
  userProfile: user,
35
46
  });
36
- return (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', formClassName), "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: onEditProfileCancel }, { 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" }))] })] }))) })));
47
+ const makeButtonsContent = (isSubmitting, isValid, dirty) => (jsxs(Fragment, { children: [!options.hideCancelButton && (jsx(Button, Object.assign({ disabled: fetch, buttonRounded: 'small', expanded: true, buttonPadding: 'medium', buttonVariant: 'secondary', type: 'button', typographyProps: { variant: 'button_secondary' }, onClick: onEditProfileCancel, dataTestId: 'cancel-button' }, options.cancelButtonProps, { children: options.cancelText }))), 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, {}), dataTestId: 'submit-button' }, options.submitButtonProps, { children: options.submitText }))] }));
48
+ return (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', formClassName), "data-testid": 'editUserProfileForm' }, { children: [jsx("div", Object.assign({ className: 'dynamic-widget-edit-profile-view__fields', style: fieldsContainerStyle }, { children: jsx(UserDataFields, { errors: errors, fields: targetFields, touched: touched }) })), options.buttonsAsFooter ? (jsx(DynamicWidgetFooter, { children: makeButtonsContent(isSubmitting, isValid, dirty) })) : (makeButtonsContent(isSubmitting, isValid, dirty))] }))) })));
37
49
  };
38
50
 
39
51
  export { UserProfileForm };
@@ -0,0 +1 @@
1
+ export * from './UserProfileForm';
@@ -250,6 +250,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
250
250
  setWalletsToConnectByChain(walletsByChain);
251
251
  setShowBridgeWidget(false);
252
252
  localStorage.LocalStorage.removeFromLS(localStorage$1.WALLET_PICKER_SEARCH_KEY);
253
+ if (!toolkitEnabled) {
254
+ localStorage.LocalStorage.removeFromLS(localStorage$1.IS_MULTI_WALLET_ENABLED);
255
+ }
253
256
  const jwt = getAuthToken.getAuthToken();
254
257
  if (jwt && user) {
255
258
  // do not await this async call - just fire and forget
@@ -357,9 +360,12 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
357
360
  user,
358
361
  });
359
362
  const sendWagmiSettings = (settings) => {
360
- api.sendDynamicProps(environmentId, {
361
- dynamicWagmiSettings: settings.dynamicWagmiSettings,
362
- });
363
+ const { dynamicWagmiSettings } = settings;
364
+ if (dynamicWagmiSettings) {
365
+ api.sendDynamicProps(environmentId, {
366
+ dynamicWagmiSettings: { dynamicWagmiSettings },
367
+ });
368
+ }
363
369
  };
364
370
  const clearStatesOnBackClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
365
371
  setDesktopUri('');
@@ -10,7 +10,7 @@ import { Toolkit } from '../../components/Toolkit/Toolkit.js';
10
10
  import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
11
11
  import { ViewContextProvider } from '../ViewContext/ViewContext.js';
12
12
  import { logger } from '../../shared/logger.js';
13
- import { IS_FULLY_CONNECTED, AUTH_TOKEN, AUTH_USER, AUTH_MODE, WALLET_PICKER_SEARCH_KEY } from '../../utils/constants/localStorage.js';
13
+ import { IS_FULLY_CONNECTED, AUTH_TOKEN, AUTH_USER, AUTH_MODE, WALLET_PICKER_SEARCH_KEY, IS_MULTI_WALLET_ENABLED } from '../../utils/constants/localStorage.js';
14
14
  import '../../utils/constants/colors.js';
15
15
  import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
16
16
  import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
@@ -246,6 +246,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
246
246
  setWalletsToConnectByChain(walletsByChain);
247
247
  setShowBridgeWidget(false);
248
248
  LocalStorage.removeFromLS(WALLET_PICKER_SEARCH_KEY);
249
+ if (!toolkitEnabled) {
250
+ LocalStorage.removeFromLS(IS_MULTI_WALLET_ENABLED);
251
+ }
249
252
  const jwt = getAuthToken();
250
253
  if (jwt && user) {
251
254
  // do not await this async call - just fire and forget
@@ -353,9 +356,12 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
353
356
  user,
354
357
  });
355
358
  const sendWagmiSettings = (settings) => {
356
- sendDynamicProps(environmentId, {
357
- dynamicWagmiSettings: settings.dynamicWagmiSettings,
358
- });
359
+ const { dynamicWagmiSettings } = settings;
360
+ if (dynamicWagmiSettings) {
361
+ sendDynamicProps(environmentId, {
362
+ dynamicWagmiSettings: { dynamicWagmiSettings },
363
+ });
364
+ }
359
365
  };
360
366
  const clearStatesOnBackClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
361
367
  setDesktopUri('');
@@ -1,5 +1,5 @@
1
1
  import { SetStateAction, Dispatch, PropsWithChildren, FC } from 'react';
2
- export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists';
2
+ export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts';
3
3
  export type ViewContextProps = {
4
4
  setView: Dispatch<SetStateAction<ViewType>>;
5
5
  view: ViewType;
@@ -128,6 +128,9 @@ const verifyEmail = ({ verificationToken, verificationUUID, environmentId, }, us
128
128
  catch (e) {
129
129
  const data = yield e.json();
130
130
  logger.logger.error(data.error);
131
+ if (data.code === sdkApi$1.UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
132
+ throw new utils.UserHasAccountWithEmailError(data.error);
133
+ }
131
134
  throw new utils.EmailVerificationError(data.code);
132
135
  }
133
136
  });
@@ -396,6 +399,18 @@ const sendDynamicProps = (environmentId, settingsToSend) => _tslib.__awaiter(voi
396
399
  catch (e) {
397
400
  logger.logger.error(e);
398
401
  }
402
+ });
403
+ const mergeUserAccounts = (userJwt, environmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
404
+ try {
405
+ const { jwt } = yield sdkApi(userJwt).mergeUsers({
406
+ environmentId,
407
+ });
408
+ return jwt;
409
+ }
410
+ catch (e) {
411
+ logger.logger.error(e);
412
+ throw e;
413
+ }
399
414
  });
400
415
 
401
416
  exports.createEmailVerification = createEmailVerification;
@@ -409,6 +424,7 @@ exports.linkWallet = linkWallet;
409
424
  exports.mapAuthModeTypeToEnum = mapAuthModeTypeToEnum;
410
425
  exports.mapChainToChainEnum = mapChainToChainEnum;
411
426
  exports.mapProviderToProviderEnum = mapProviderToProviderEnum;
427
+ exports.mergeUserAccounts = mergeUserAccounts;
412
428
  exports.retryEmailVerification = retryEmailVerification;
413
429
  exports.revokeSession = revokeSession;
414
430
  exports.sendDynamicProps = sendDynamicProps;
@@ -66,3 +66,4 @@ export declare const sendDynamicProps: (environmentId: string, settingsToSend: {
66
66
  dynamicContextProps?: object;
67
67
  dynamicWagmiSettings?: object;
68
68
  }) => Promise<void>;
69
+ export declare const mergeUserAccounts: (userJwt: string, environmentId: string) => Promise<string | undefined>;
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from '../../../_virtual/_tslib.js';
2
- import { NoAccessError, AccountExistsError, EmailVerificationError, DynamicError, EmailAlreadyExistsError, UsernameAlreadyExistsError, EmailProviderError, WalletUsedError, WalletNotDeployedError, ChainalysisError, GateBlockedError } from '@dynamic-labs/utils';
3
- import { SDKApi, Configuration, VerifyRequestFromJSON, ChainEnum, WalletProviderEnum, AuthModeEnum } from '@dynamic-labs/sdk-api';
2
+ import { NoAccessError, AccountExistsError, EmailVerificationError, UserHasAccountWithEmailError, DynamicError, EmailAlreadyExistsError, UsernameAlreadyExistsError, EmailProviderError, WalletUsedError, WalletNotDeployedError, ChainalysisError, GateBlockedError } from '@dynamic-labs/utils';
3
+ import { UnprocessableEntityErrorCode, SDKApi, Configuration, VerifyRequestFromJSON, ChainEnum, WalletProviderEnum, AuthModeEnum } from '@dynamic-labs/sdk-api';
4
4
  import { VERSION, API_VERSION } from '../../version.js';
5
5
  import ApiEndpoint from '../config/ApiEndpoint.js';
6
6
  import { logger } from '../shared/logger.js';
@@ -124,6 +124,9 @@ const verifyEmail = ({ verificationToken, verificationUUID, environmentId, }, us
124
124
  catch (e) {
125
125
  const data = yield e.json();
126
126
  logger.error(data.error);
127
+ if (data.code === UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
128
+ throw new UserHasAccountWithEmailError(data.error);
129
+ }
127
130
  throw new EmailVerificationError(data.code);
128
131
  }
129
132
  });
@@ -392,6 +395,18 @@ const sendDynamicProps = (environmentId, settingsToSend) => __awaiter(void 0, vo
392
395
  catch (e) {
393
396
  logger.error(e);
394
397
  }
398
+ });
399
+ const mergeUserAccounts = (userJwt, environmentId) => __awaiter(void 0, void 0, void 0, function* () {
400
+ try {
401
+ const { jwt } = yield sdkApi(userJwt).mergeUsers({
402
+ environmentId,
403
+ });
404
+ return jwt;
405
+ }
406
+ catch (e) {
407
+ logger.error(e);
408
+ throw e;
409
+ }
395
410
  });
396
411
 
397
- export { createEmailVerification, createVisit, fetchNetworkSettings, fetchNonce, fetchProjectSettings, getEmailProvider, getOnrampProviders, linkWallet, mapAuthModeTypeToEnum, mapChainToChainEnum, mapProviderToProviderEnum, retryEmailVerification, revokeSession, sendDynamicProps, signInWithEmailVerification, transferWallet, unlinkOAuth, unlinkWallet, updateUserProfileFields, verifyEmail, verifyOAuth, verifyWallet };
412
+ export { createEmailVerification, createVisit, fetchNetworkSettings, fetchNonce, fetchProjectSettings, getEmailProvider, getOnrampProviders, linkWallet, mapAuthModeTypeToEnum, mapChainToChainEnum, mapProviderToProviderEnum, mergeUserAccounts, retryEmailVerification, revokeSession, sendDynamicProps, signInWithEmailVerification, transferWallet, unlinkOAuth, unlinkWallet, updateUserProfileFields, verifyEmail, verifyOAuth, verifyWallet };
@@ -32,7 +32,7 @@ require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs'
32
32
  require('../../../config/ApiEndpoint.cjs');
33
33
  require('@dynamic-labs/rpc-providers');
34
34
  require('../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
35
- require('../../../context/ErrorContext/ErrorContext.cjs');
35
+ var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
36
36
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
37
37
  var AccountExistsContext = require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
38
38
  var ModalHeader = require('../../../components/ModalHeader/ModalHeader.cjs');
@@ -55,6 +55,7 @@ var index = require('../../../context/FooterAnimationContext/index.cjs');
55
55
 
56
56
  const Header = ({ onClose: handleClose, heading, projectSettings, walletConnector, }) => {
57
57
  const { clearStatesOnBackClick, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
58
+ const { setError } = ErrorContext.useErrorContext();
58
59
  const { setShowQrCodeImage } = QrCodeContext.useQrCodeContext();
59
60
  const { isFooterExpanded, setIsFooterExpanded } = index.useFooterAnimationContext();
60
61
  const { view, goToInitialView } = ViewContext.useViewContext();
@@ -63,11 +64,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
63
64
  const handleBackClick = React.useCallback(() => {
64
65
  goToInitialView();
65
66
  setExistentAccountData(undefined);
67
+ setError(undefined);
66
68
  // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
67
69
  if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
68
70
  clearStatesOnBackClick();
69
71
  }
70
- }, [clearStatesOnBackClick, selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, goToInitialView]);
72
+ }, [
73
+ goToInitialView,
74
+ setExistentAccountData,
75
+ setError,
76
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
77
+ clearStatesOnBackClick,
78
+ ]);
71
79
  const leadingButtons = React.useMemo(() => {
72
80
  let buttons = [];
73
81
  if (showBackButton) {
@@ -28,7 +28,7 @@ import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
28
28
  import '../../../config/ApiEndpoint.js';
29
29
  import '@dynamic-labs/rpc-providers';
30
30
  import '../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
31
- import '../../../context/ErrorContext/ErrorContext.js';
31
+ import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
32
32
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
33
33
  import { useAccountExistsContext } from '../../../context/AccountExistsContext/AccountExistsContext.js';
34
34
  import { ModalHeader } from '../../../components/ModalHeader/ModalHeader.js';
@@ -51,6 +51,7 @@ import { useFooterAnimationContext } from '../../../context/FooterAnimationConte
51
51
 
52
52
  const Header = ({ onClose: handleClose, heading, projectSettings, walletConnector, }) => {
53
53
  const { clearStatesOnBackClick, selectedWalletConnector } = useInternalDynamicContext();
54
+ const { setError } = useErrorContext();
54
55
  const { setShowQrCodeImage } = useQrCodeContext();
55
56
  const { isFooterExpanded, setIsFooterExpanded } = useFooterAnimationContext();
56
57
  const { view, goToInitialView } = useViewContext();
@@ -59,11 +60,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
59
60
  const handleBackClick = useCallback(() => {
60
61
  goToInitialView();
61
62
  setExistentAccountData(undefined);
63
+ setError(undefined);
62
64
  // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
63
65
  if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
64
66
  clearStatesOnBackClick();
65
67
  }
66
- }, [clearStatesOnBackClick, selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, goToInitialView]);
68
+ }, [
69
+ goToInitialView,
70
+ setExistentAccountData,
71
+ setError,
72
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
73
+ clearStatesOnBackClick,
74
+ ]);
67
75
  const leadingButtons = useMemo(() => {
68
76
  let buttons = [];
69
77
  if (showBackButton) {
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ var _path;
28
+ var _excluded = ["title", "titleId"];
29
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
30
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
32
+ var SvgDoubleArrowRight = function SvgDoubleArrowRight(_ref) {
33
+ var title = _ref.title,
34
+ titleId = _ref.titleId,
35
+ props = _objectWithoutProperties(_ref, _excluded);
36
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
37
+ width: 16,
38
+ height: 16,
39
+ viewBox: "0 0 16 16",
40
+ fill: "none",
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ "aria-labelledby": titleId
43
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
44
+ id: titleId
45
+ }, title) : null, _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
46
+ fillRule: "evenodd",
47
+ clipRule: "evenodd",
48
+ d: "M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",
49
+ fill: "currentColor"
50
+ })));
51
+ };
52
+
53
+ exports.ReactComponent = SvgDoubleArrowRight;
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ var _path;
4
+ var _excluded = ["title", "titleId"];
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ var SvgDoubleArrowRight = function SvgDoubleArrowRight(_ref) {
9
+ var title = _ref.title,
10
+ titleId = _ref.titleId,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+ return /*#__PURE__*/React.createElement("svg", _extends({
13
+ width: 16,
14
+ height: 16,
15
+ viewBox: "0 0 16 16",
16
+ fill: "none",
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ "aria-labelledby": titleId
19
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
20
+ id: titleId
21
+ }, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
22
+ fillRule: "evenodd",
23
+ clipRule: "evenodd",
24
+ d: "M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",
25
+ fill: "currentColor"
26
+ })));
27
+ };
28
+
29
+ export { SvgDoubleArrowRight as ReactComponent };
@@ -34,3 +34,4 @@ export { ReactComponent as SwitchHorizontalIcon } from './switch-horizontal.svg'
34
34
  export { ReactComponent as DotsHorizontalIcon } from './dots-horizontal.svg';
35
35
  export { ReactComponent as SendIcon } from './send.svg';
36
36
  export { ReactComponent as QuestionMarkIcon } from './question-mark.svg';
37
+ export { ReactComponent as DoubleArrowRightIcon } from './double-arrow-right.svg';