@dynamic-labs/sdk-react-core 0.17.0-RC.21 → 0.17.0-RC.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ## [0.17.0-RC.22](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.21...v0.17.0-RC.22) (2023-06-02)
3
+
4
+
5
+ ### Features
6
+
7
+ * social copy update ([#2215](https://github.com/dynamic-labs/DynamicAuth/issues/2215)) ([1fe7316](https://github.com/dynamic-labs/DynamicAuth/commit/1fe7316a94284db7227d5ab09026354269559752))
8
+
2
9
  ## [0.17.0-RC.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.20...v0.17.0-RC.21) (2023-06-02)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.17.0-RC.21";
5
+ var version = "0.17.0-RC.22";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
8
  "@dynamic-labs/iconic": "0.1.19",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.17.0-RC.21";
1
+ var version = "0.17.0-RC.22";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
4
  "@dynamic-labs/iconic": "0.1.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.17.0-RC.21",
3
+ "version": "0.17.0-RC.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,12 +17,12 @@
17
17
  "formik": "2.2.9",
18
18
  "qrcode": "1.5.1",
19
19
  "ethers": "5.7.2",
20
- "@dynamic-labs/logger": "0.17.0-RC.21",
21
- "@dynamic-labs/multi-wallet": "0.17.0-RC.21",
22
- "@dynamic-labs/rpc-providers": "0.17.0-RC.21",
23
- "@dynamic-labs/types": "0.17.0-RC.21",
24
- "@dynamic-labs/utils": "0.17.0-RC.21",
25
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.21"
20
+ "@dynamic-labs/logger": "0.17.0-RC.22",
21
+ "@dynamic-labs/multi-wallet": "0.17.0-RC.22",
22
+ "@dynamic-labs/rpc-providers": "0.17.0-RC.22",
23
+ "@dynamic-labs/types": "0.17.0-RC.22",
24
+ "@dynamic-labs/utils": "0.17.0-RC.22",
25
+ "@dynamic-labs/wallet-connector-core": "0.17.0-RC.22"
26
26
  },
27
27
  "devDependencies": {
28
28
  "semver": "7.3.8"
@@ -61,7 +61,7 @@ const SocialRedirectContextProvider = ({ children, }) => {
61
61
  const [redirectStatus, setRedirectStatus] = React.useState('idle');
62
62
  const [socialProvider, setSocialProvider] = React.useState();
63
63
  const wallet = secondaryWallets.find((wallet) => wallet.connector.key === (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.key));
64
- const socialAccount = React.useMemo(() => (wallet ? getReferencedAccount.getReferencedAccount(authToken, '123') : undefined), [authToken, wallet]);
64
+ const socialAccount = React.useMemo(() => (wallet ? getReferencedAccount.getReferencedAccount(authToken, wallet.id) : undefined), [authToken, wallet]);
65
65
  const handleError = React.useCallback((message) => {
66
66
  logger.logger.error(message);
67
67
  if (isAuthenticated) {
@@ -57,7 +57,7 @@ const SocialRedirectContextProvider = ({ children, }) => {
57
57
  const [redirectStatus, setRedirectStatus] = useState('idle');
58
58
  const [socialProvider, setSocialProvider] = useState();
59
59
  const wallet = secondaryWallets.find((wallet) => wallet.connector.key === (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.key));
60
- const socialAccount = useMemo(() => (wallet ? getReferencedAccount(authToken, '123') : undefined), [authToken, wallet]);
60
+ const socialAccount = useMemo(() => (wallet ? getReferencedAccount(authToken, wallet.id) : undefined), [authToken, wallet]);
61
61
  const handleError = useCallback((message) => {
62
62
  logger.error(message);
63
63
  if (isAuthenticated) {
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
6
7
  var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
7
8
  var DefaultPromptModal = require('../DefaultPromptModal/DefaultPromptModal.cjs');
8
9
  require('react');
@@ -10,13 +11,13 @@ var Typography = require('../../../../components/Typography/Typography.cjs');
10
11
  require('@dynamic-labs/sdk-api');
11
12
  require('../../../../shared/logger.cjs');
12
13
  require('@dynamic-labs/iconic');
13
- require('@dynamic-labs/wallet-connector-core');
14
14
  require('../../../../context/ViewContext/ViewContext.cjs');
15
15
  require('@dynamic-labs/utils');
16
16
  require('../../../../utils/constants/colors.cjs');
17
17
  require('ethers');
18
18
  require('../../../../shared/consts/index.cjs');
19
19
  require('@dynamic-labs/multi-wallet');
20
+ var getReferencedAccount = require('../../../../utils/functions/getReferencedAccount/getReferencedAccount.cjs');
20
21
  require('../../../../components/ShadowDOM/ShadowDOM.cjs');
21
22
  require('../../../../context/ThemeContext/ThemeContext.cjs');
22
23
  require('react-dom');
@@ -38,11 +39,24 @@ require('../../../../components/Popper/Popper/Popper.cjs');
38
39
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
39
40
  require('../../../../components/SendBalanceForm/SendBalanceForm.cjs');
40
41
  var WalletOrSocialMagicIcon = require('../../../../components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.cjs');
42
+ var helpers = require('../../helpers/helpers.cjs');
41
43
 
42
44
  const PendingConnectionModal = () => {
45
+ var _a;
43
46
  const { selectedWalletConnector, authToken, selectedWalletWithAction } = useInternalDynamicContext.useInternalDynamicContext();
47
+ let title;
48
+ let description;
49
+ if (selectedWalletWithAction &&
50
+ walletConnectorCore.isSocialWalletConnector(selectedWalletWithAction.wallet.connector)) {
51
+ const account = getReferencedAccount.getReferencedAccount(authToken, selectedWalletWithAction.wallet.id);
52
+ title = `Reconnecting ${helpers.capitalize((_a = account === null || account === void 0 ? void 0 : account.oauthProvider) !== null && _a !== void 0 ? _a : '')}`;
53
+ }
54
+ else {
55
+ title = `Connect ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name} wallet`;
56
+ description = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["Connect your", ' ', jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name })), ' ', "wallet to make active."] }));
57
+ }
44
58
  return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptModal, Object.assign({ showCloseButton: true, dataTestId: 'pending-connection-modal', icon: jsxRuntime.jsx(WalletOrSocialMagicIcon.WalletOrSocialMagicIcon // eslint-disable-line
45
- , { jwt: authToken, wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: `Connect ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name} wallet` }, { children: jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Connect your", ' ', jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name })), ' ', "wallet to make active."] })) })));
59
+ , { jwt: authToken, wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: title }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: description })) })));
46
60
  };
47
61
 
48
62
  exports.PendingConnectionModal = PendingConnectionModal;
@@ -1,4 +1,5 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
2
3
  import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
3
4
  import { DefaultPromptModal } from '../DefaultPromptModal/DefaultPromptModal.js';
4
5
  import 'react';
@@ -6,13 +7,13 @@ import { Typography } from '../../../../components/Typography/Typography.js';
6
7
  import '@dynamic-labs/sdk-api';
7
8
  import '../../../../shared/logger.js';
8
9
  import '@dynamic-labs/iconic';
9
- import '@dynamic-labs/wallet-connector-core';
10
10
  import '../../../../context/ViewContext/ViewContext.js';
11
11
  import '@dynamic-labs/utils';
12
12
  import '../../../../utils/constants/colors.js';
13
13
  import 'ethers';
14
14
  import '../../../../shared/consts/index.js';
15
15
  import '@dynamic-labs/multi-wallet';
16
+ import { getReferencedAccount } from '../../../../utils/functions/getReferencedAccount/getReferencedAccount.js';
16
17
  import '../../../../components/ShadowDOM/ShadowDOM.js';
17
18
  import '../../../../context/ThemeContext/ThemeContext.js';
18
19
  import 'react-dom';
@@ -34,11 +35,24 @@ import '../../../../components/Popper/Popper/Popper.js';
34
35
  import '../../../../components/Popper/PopperContext/PopperContext.js';
35
36
  import '../../../../components/SendBalanceForm/SendBalanceForm.js';
36
37
  import { WalletOrSocialMagicIcon } from '../../../../components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.js';
38
+ import { capitalize } from '../../helpers/helpers.js';
37
39
 
38
40
  const PendingConnectionModal = () => {
41
+ var _a;
39
42
  const { selectedWalletConnector, authToken, selectedWalletWithAction } = useInternalDynamicContext();
43
+ let title;
44
+ let description;
45
+ if (selectedWalletWithAction &&
46
+ isSocialWalletConnector(selectedWalletWithAction.wallet.connector)) {
47
+ const account = getReferencedAccount(authToken, selectedWalletWithAction.wallet.id);
48
+ title = `Reconnecting ${capitalize((_a = account === null || account === void 0 ? void 0 : account.oauthProvider) !== null && _a !== void 0 ? _a : '')}`;
49
+ }
50
+ else {
51
+ title = `Connect ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name} wallet`;
52
+ description = (jsxs(Fragment, { children: ["Connect your", ' ', jsx(Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name })), ' ', "wallet to make active."] }));
53
+ }
40
54
  return (jsx(DefaultPromptModal, Object.assign({ showCloseButton: true, dataTestId: 'pending-connection-modal', icon: jsx(WalletOrSocialMagicIcon // eslint-disable-line
41
- , { jwt: authToken, wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: `Connect ${selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name} wallet` }, { children: jsxs(Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Connect your", ' ', jsx(Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name })), ' ', "wallet to make active."] })) })));
55
+ , { jwt: authToken, wallet: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet }), title: title }, { children: jsx(Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: description })) })));
42
56
  };
43
57
 
44
58
  export { PendingConnectionModal };