@dynamic-labs/sdk-react-core 0.17.0-RC.23 → 0.17.0-RC.25

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 (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +7 -7
  5. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +2 -1
  6. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +2 -1
  7. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
  8. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
  9. package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs +2 -2
  10. package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.d.ts +2 -0
  11. package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js +2 -2
  12. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
  13. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
  14. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +7 -0
  15. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +7 -0
  16. package/src/lib/shared/assets/add.cjs +8 -9
  17. package/src/lib/shared/assets/add.js +8 -9
  18. package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.cjs +27 -0
  19. package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.d.ts +6 -0
  20. package/src/lib/shared/utils/functions/shortenEmail/shortenEmail.js +23 -0
  21. package/src/lib/styles/index.shadow.cjs +1 -1
  22. package/src/lib/styles/index.shadow.js +1 -1
  23. package/src/lib/utils/functions/hasWalletGroupFlag/hasWalletGroupFlag.d.ts +1 -0
  24. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +2 -1
  25. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +2 -1
  26. package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -1
  27. package/src/lib/views/EmailVerification/EmailVerification.js +2 -1
  28. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +3 -2
  29. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +3 -2
  30. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +2 -2
  31. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +2 -2
  32. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +12 -1
  33. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +12 -1
  34. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +6 -1
  35. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +7 -2
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useState } from 'react';
3
4
  import '@dynamic-labs/sdk-api';
@@ -9,7 +10,7 @@ import '@dynamic-labs/utils';
9
10
  import '../../../../utils/constants/colors.js';
10
11
  import 'ethers';
11
12
  import '../../../../shared/consts/index.js';
12
- import '../../../../context/DynamicContext/DynamicContext.js';
13
+ import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
13
14
  import '@dynamic-labs/multi-wallet';
14
15
  import '../../../../components/ShadowDOM/ShadowDOM.js';
15
16
  import '../../../../context/ThemeContext/ThemeContext.js';
@@ -35,6 +36,7 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
35
36
  import '../../../../components/SendBalanceForm/SendBalanceForm.js';
36
37
 
37
38
  const EmailOTPConnectorPendingSignModalContent = ({ walletConnector }) => {
39
+ const { setSelectedWalletWithAction, selectedWalletWithAction, setPrimaryWalletId, setMultiWalletWidgetState, computeConnectedStateForWallets, } = useInternalDynamicContext();
38
40
  const [error, setError] = useState();
39
41
  const { email } = walletConnector;
40
42
  if (!email) {
@@ -42,6 +44,15 @@ const EmailOTPConnectorPendingSignModalContent = ({ walletConnector }) => {
42
44
  }
43
45
  const { data: isValid, isLoading, mutate: onSubmit, } = useMutation((otp) => walletConnector.verifyOneTimePassword(otp), {
44
46
  onFailure: (error) => setError(error),
47
+ onSuccess: () => __awaiter(void 0, void 0, void 0, function* () {
48
+ if (!selectedWalletWithAction) {
49
+ return;
50
+ }
51
+ yield computeConnectedStateForWallets();
52
+ setMultiWalletWidgetState('idle');
53
+ setSelectedWalletWithAction(null);
54
+ setPrimaryWalletId(selectedWalletWithAction.wallet.id);
55
+ }),
45
56
  });
46
57
  return (jsx(OTPVerificationView, { email: email, error: error, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined) }));
47
58
  };
@@ -46,8 +46,10 @@ var helpers = require('../../helpers/helpers.cjs');
46
46
  var WalletOrSocialMagicIcon = require('../../../../components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.cjs');
47
47
 
48
48
  const Wallet = ({ wallet, ens }) => {
49
+ var _a;
49
50
  const { id: walletId, connector, address } = wallet;
50
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
51
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, } = useInternalDynamicContext.useInternalDynamicContext();
52
+ const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
51
53
  const iconSize = 20;
52
54
  const options = [
53
55
  {
@@ -80,6 +82,9 @@ const Wallet = ({ wallet, ens }) => {
80
82
  connector.connectedChain === 'FLOW') {
81
83
  yield connector.endSession();
82
84
  }
85
+ if (walletConnectorCore.isEmailWalletConnector(connector) && email) {
86
+ connector.setEmail(email);
87
+ }
83
88
  setShowWidgetStatePopup(true);
84
89
  setSelectedWalletWithAction({ action: 'select', wallet });
85
90
  setPrimaryWallet(walletId);
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
3
+ import { isEmbeddedConnector, isEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
4
4
  import '@dynamic-labs/iconic';
5
5
  import '../../../../context/ViewContext/ViewContext.js';
6
6
  import 'react';
@@ -42,8 +42,10 @@ import { copyToClipboard } from '../../helpers/helpers.js';
42
42
  import { WalletOrSocialMagicIcon } from '../../../../components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.js';
43
43
 
44
44
  const Wallet = ({ wallet, ens }) => {
45
+ var _a;
45
46
  const { id: walletId, connector, address } = wallet;
46
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, } = useInternalDynamicContext();
47
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, } = useInternalDynamicContext();
48
+ const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
47
49
  const iconSize = 20;
48
50
  const options = [
49
51
  {
@@ -76,6 +78,9 @@ const Wallet = ({ wallet, ens }) => {
76
78
  connector.connectedChain === 'FLOW') {
77
79
  yield connector.endSession();
78
80
  }
81
+ if (isEmailWalletConnector(connector) && email) {
82
+ connector.setEmail(email);
83
+ }
79
84
  setShowWidgetStatePopup(true);
80
85
  setSelectedWalletWithAction({ action: 'select', wallet });
81
86
  setPrimaryWallet(walletId);