@dynamic-labs/sdk-react-core 0.17.0-RC.30 → 0.17.0-RC.31

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 (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +9 -9
  5. package/src/index.cjs +1 -1
  6. package/src/index.js +1 -1
  7. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +26 -4
  8. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +24 -2
  9. package/src/lib/components/Divider/Divider.cjs +1 -1
  10. package/src/lib/components/Divider/Divider.d.ts +1 -1
  11. package/src/lib/components/Divider/Divider.js +2 -2
  12. package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
  13. package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
  14. package/src/lib/utils/hooks/index.d.ts +2 -0
  15. package/src/lib/utils/hooks/useColorSchemePreference/index.d.ts +1 -0
  16. package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.cjs +27 -0
  17. package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.d.ts +1 -0
  18. package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.js +23 -0
  19. package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +3 -1
  20. package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +4 -2
  21. package/src/lib/utils/hooks/useGetSocialIcon/index.d.ts +1 -0
  22. package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs +17 -0
  23. package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.d.ts +2 -0
  24. package/src/lib/utils/hooks/useGetSocialIcon/useGetSocialIcon.js +13 -0
  25. package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +19 -15
  26. package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.d.ts +7 -4
  27. package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +20 -16
  28. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +3 -2
  29. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +2 -1
  30. package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +3 -2
  31. package/src/lib/views/SocialRedirectView/SocialRedirectView.js +2 -1
  32. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +3 -2
  33. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +2 -1
  34. package/src/lib/utils/functions/getSocialIcon/getSocialIcon.cjs +0 -22
  35. package/src/lib/utils/functions/getSocialIcon/getSocialIcon.d.ts +0 -3
  36. package/src/lib/utils/functions/getSocialIcon/getSocialIcon.js +0 -18
  37. package/src/lib/utils/functions/getSocialIcon/index.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [0.17.0-RC.31](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.30...v0.17.0-RC.31) (2023-06-09)
3
+
4
+
5
+ ### Features
6
+
7
+ * add fake dapper mobile metadata so that it appears on mobile ([#2288](https://github.com/dynamic-labs/DynamicAuth/issues/2288)) ([ea98462](https://github.com/dynamic-labs/DynamicAuth/commit/ea98462e762d3fa032e2e40f17d2e3679146b3ae))
8
+ * pass variant to social icon getter ([#2277](https://github.com/dynamic-labs/DynamicAuth/issues/2277)) ([b1492ed](https://github.com/dynamic-labs/DynamicAuth/commit/b1492eda50eb80fbfee1aa968771f338694ef7e6))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * don't remove network config from ls if there's a connected wallet ([#2280](https://github.com/dynamic-labs/DynamicAuth/issues/2280)) ([0703dfc](https://github.com/dynamic-labs/DynamicAuth/commit/0703dfc099f86a0802e83a27849b6953e1ddca31))
14
+ * **use-wallets-connection-state:** load connected state when wallets are present ([#2285](https://github.com/dynamic-labs/DynamicAuth/issues/2285)) ([7fb72dc](https://github.com/dynamic-labs/DynamicAuth/commit/7fb72dc8fe1404cd76e68bb3f0de9efa78634525))
15
+
2
16
  ## [0.17.0-RC.30](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.29...v0.17.0-RC.30) (2023-06-08)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.17.0-RC.30";
5
+ var version = "0.17.0-RC.31";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
- "@dynamic-labs/iconic": "0.1.19",
8
+ "@dynamic-labs/iconic": "0.1.23",
9
9
  "@dynamic-labs/sdk-api": "0.0.198",
10
10
  "@hcaptcha/react-hcaptcha": "1.4.4",
11
11
  "country-list": "2.3.0",
package/package.js CHANGED
@@ -1,7 +1,7 @@
1
- var version = "0.17.0-RC.30";
1
+ var version = "0.17.0-RC.31";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
- "@dynamic-labs/iconic": "0.1.19",
4
+ "@dynamic-labs/iconic": "0.1.23",
5
5
  "@dynamic-labs/sdk-api": "0.0.198",
6
6
  "@hcaptcha/react-hcaptcha": "1.4.4",
7
7
  "country-list": "2.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.17.0-RC.30",
3
+ "version": "0.17.0-RC.31",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react-focus-lock": "2.9.2",
11
- "@dynamic-labs/iconic": "0.1.19",
11
+ "@dynamic-labs/iconic": "0.1.23",
12
12
  "@dynamic-labs/sdk-api": "0.0.198",
13
13
  "@hcaptcha/react-hcaptcha": "1.4.4",
14
14
  "country-list": "2.3.0",
@@ -16,13 +16,13 @@
16
16
  "formik": "2.2.9",
17
17
  "qrcode": "1.5.1",
18
18
  "ethers": "5.7.2",
19
- "@dynamic-labs/logger": "0.17.0-RC.30",
20
- "@dynamic-labs/multi-wallet": "0.17.0-RC.30",
21
- "@dynamic-labs/rpc-providers": "0.17.0-RC.30",
22
- "@dynamic-labs/types": "0.17.0-RC.30",
23
- "@dynamic-labs/utils": "0.17.0-RC.30",
24
- "@dynamic-labs/wallet-book": "0.17.0-RC.30",
25
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.30"
19
+ "@dynamic-labs/logger": "0.17.0-RC.31",
20
+ "@dynamic-labs/multi-wallet": "0.17.0-RC.31",
21
+ "@dynamic-labs/rpc-providers": "0.17.0-RC.31",
22
+ "@dynamic-labs/types": "0.17.0-RC.31",
23
+ "@dynamic-labs/utils": "0.17.0-RC.31",
24
+ "@dynamic-labs/wallet-book": "0.17.0-RC.31",
25
+ "@dynamic-labs/wallet-connector-core": "0.17.0-RC.31"
26
26
  },
27
27
  "devDependencies": {
28
28
  "semver": "7.3.8"
package/src/index.cjs CHANGED
@@ -96,8 +96,8 @@ require('@dynamic-labs/wallet-book');
96
96
  require('./lib/components/Alert/Alert.cjs');
97
97
  var useWalletItemActions = require('./lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs');
98
98
  var useUserUpdateRequest = require('./lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
99
- var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
100
99
  require('@dynamic-labs/iconic');
100
+ var DynamicConnectButton = require('./lib/components/DynamicConnectButton/DynamicConnectButton.cjs');
101
101
  require('./lib/components/Popper/Popper/Popper.cjs');
102
102
  require('./lib/components/Popper/PopperContext/PopperContext.cjs');
103
103
  require('formik');
package/src/index.js CHANGED
@@ -92,8 +92,8 @@ import '@dynamic-labs/wallet-book';
92
92
  import './lib/components/Alert/Alert.js';
93
93
  export { useWalletItemActions } from './lib/utils/hooks/useWalletItemActions/useWalletItemActions.js';
94
94
  export { useUserUpdateRequest } from './lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
95
- export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
96
95
  import '@dynamic-labs/iconic';
96
+ export { DynamicConnectButton } from './lib/components/DynamicConnectButton/DynamicConnectButton.js';
97
97
  import './lib/components/Popper/Popper/Popper.js';
98
98
  import './lib/components/Popper/PopperContext/PopperContext.js';
99
99
  import 'formik';
@@ -16,20 +16,40 @@ require('react');
16
16
  require('ethers');
17
17
  var pixelToRem = require('../../utils/functions/pixelToRem/pixelToRem.cjs');
18
18
  var getReferencedAccount = require('../../utils/functions/getReferencedAccount/getReferencedAccount.cjs');
19
- var getSocialIcon = require('../../utils/functions/getSocialIcon/getSocialIcon.cjs');
20
19
  var IconWithStatus = require('../IconWithStatus/IconWithStatus.cjs');
21
20
  var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
22
21
  var WalletIconWithStatus = require('../../widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs');
23
22
  var AccessDeniedContext = require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
23
+ require('../../config/ApiEndpoint.cjs');
24
+ require('../../shared/consts/index.cjs');
25
+ require('@dynamic-labs/rpc-providers');
26
+ require('../../context/ErrorContext/ErrorContext.cjs');
27
+ require('react-dom');
28
+ require('../ShadowDOM/ShadowDOM.cjs');
29
+ require('../../context/ThemeContext/ThemeContext.cjs');
30
+ require('react-focus-lock');
31
+ require('../Transition/ZoomTransition/ZoomTransition.cjs');
32
+ require('../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
33
+ require('../Transition/OpacityTransition/OpacityTransition.cjs');
34
+ require('../IconButton/IconButton.cjs');
35
+ require('../Alert/Alert.cjs');
36
+ require('../Popper/Popper/Popper.cjs');
37
+ require('../Popper/PopperContext/PopperContext.cjs');
38
+ require('formik');
39
+ require('yup');
40
+ require('../../context/MockContext/MockContext.cjs');
41
+ require('../../context/CaptchaContext/CaptchaContext.cjs');
42
+ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
43
+ var useGetSocialIcon = require('../../utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs');
24
44
 
25
- const getMagicEmailOrSocialIcon = ({ wallet, jwt, }) => {
45
+ const getMagicEmailOrSocialIcon = ({ getSocialIcon, wallet, jwt, }) => {
26
46
  let Icon = null;
27
47
  if (walletConnectorCore.isEmailOTPWalletConnector(wallet.connector)) {
28
48
  Icon = iconic.SignInWithEmailIcon;
29
49
  }
30
50
  if (walletConnectorCore.isSocialWalletConnector(wallet.connector)) {
31
51
  const socialAccountDataForWallet = getReferencedAccount.getReferencedAccount(jwt, wallet.id);
32
- const MagicSocialWalletIcon = getSocialIcon.getSocialIcon(socialAccountDataForWallet === null || socialAccountDataForWallet === void 0 ? void 0 : socialAccountDataForWallet.oauthProvider);
52
+ const MagicSocialWalletIcon = getSocialIcon(socialAccountDataForWallet === null || socialAccountDataForWallet === void 0 ? void 0 : socialAccountDataForWallet.oauthProvider);
33
53
  Icon = MagicSocialWalletIcon;
34
54
  }
35
55
  return Icon;
@@ -37,9 +57,10 @@ const getMagicEmailOrSocialIcon = ({ wallet, jwt, }) => {
37
57
  const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
38
58
  const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
39
59
  const { deniedOauthProvider, deniedAddress } = AccessDeniedContext.useAccessDeniedContext();
60
+ const getSocialIcon = useGetSocialIcon.useGetSocialIcon();
40
61
  // when access is denied we don't have jwt set, so we're getting this value out of useAccessDeniedContext
41
62
  if (deniedOauthProvider) {
42
- const MagicSocialWalletIcon = getSocialIcon.getSocialIcon(deniedOauthProvider);
63
+ const MagicSocialWalletIcon = getSocialIcon(deniedOauthProvider);
43
64
  return (jsxRuntime.jsx(MagicSocialWalletIcon, { style: {
44
65
  height: pixelToRem.pixelToRem(iconSize),
45
66
  width: pixelToRem.pixelToRem(iconSize),
@@ -54,6 +75,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
54
75
  }
55
76
  const walletForIcon = wallet ? wallet : primaryWallet;
56
77
  const MagicEmailOrSocialIcon = getMagicEmailOrSocialIcon({
78
+ getSocialIcon,
57
79
  jwt,
58
80
  wallet: walletForIcon,
59
81
  });
@@ -12,13 +12,33 @@ import 'react';
12
12
  import 'ethers';
13
13
  import { pixelToRem } from '../../utils/functions/pixelToRem/pixelToRem.js';
14
14
  import { getReferencedAccount } from '../../utils/functions/getReferencedAccount/getReferencedAccount.js';
15
- import { getSocialIcon } from '../../utils/functions/getSocialIcon/getSocialIcon.js';
16
15
  import { IconWithStatus } from '../IconWithStatus/IconWithStatus.js';
17
16
  import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
18
17
  import { WalletIconWithStatus } from '../../widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js';
19
18
  import { useAccessDeniedContext } from '../../context/AccessDeniedContext/AccessDeniedContext.js';
19
+ import '../../config/ApiEndpoint.js';
20
+ import '../../shared/consts/index.js';
21
+ import '@dynamic-labs/rpc-providers';
22
+ import '../../context/ErrorContext/ErrorContext.js';
23
+ import 'react-dom';
24
+ import '../ShadowDOM/ShadowDOM.js';
25
+ import '../../context/ThemeContext/ThemeContext.js';
26
+ import 'react-focus-lock';
27
+ import '../Transition/ZoomTransition/ZoomTransition.js';
28
+ import '../Transition/SlideInUpTransition/SlideInUpTransition.js';
29
+ import '../Transition/OpacityTransition/OpacityTransition.js';
30
+ import '../IconButton/IconButton.js';
31
+ import '../Alert/Alert.js';
32
+ import '../Popper/Popper/Popper.js';
33
+ import '../Popper/PopperContext/PopperContext.js';
34
+ import 'formik';
35
+ import 'yup';
36
+ import '../../context/MockContext/MockContext.js';
37
+ import '../../context/CaptchaContext/CaptchaContext.js';
38
+ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
39
+ import { useGetSocialIcon } from '../../utils/hooks/useGetSocialIcon/useGetSocialIcon.js';
20
40
 
21
- const getMagicEmailOrSocialIcon = ({ wallet, jwt, }) => {
41
+ const getMagicEmailOrSocialIcon = ({ getSocialIcon, wallet, jwt, }) => {
22
42
  let Icon = null;
23
43
  if (isEmailOTPWalletConnector(wallet.connector)) {
24
44
  Icon = SignInWithEmailIcon;
@@ -33,6 +53,7 @@ const getMagicEmailOrSocialIcon = ({ wallet, jwt, }) => {
33
53
  const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
34
54
  const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext();
35
55
  const { deniedOauthProvider, deniedAddress } = useAccessDeniedContext();
56
+ const getSocialIcon = useGetSocialIcon();
36
57
  // when access is denied we don't have jwt set, so we're getting this value out of useAccessDeniedContext
37
58
  if (deniedOauthProvider) {
38
59
  const MagicSocialWalletIcon = getSocialIcon(deniedOauthProvider);
@@ -50,6 +71,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
50
71
  }
51
72
  const walletForIcon = wallet ? wallet : primaryWallet;
52
73
  const MagicEmailOrSocialIcon = getMagicEmailOrSocialIcon({
74
+ getSocialIcon,
53
75
  jwt,
54
76
  wallet: walletForIcon,
55
77
  });
@@ -41,6 +41,6 @@ require('yup');
41
41
 
42
42
  const Divider = ({ text, className = '', fullWidth = false }) => (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('divider', className, {
43
43
  'divider__full-width': fullWidth,
44
- }) }, { children: [jsxRuntime.jsx("div", { className: 'divider__dash' }), jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'divider__text', variant: 'body_small', color: 'secondary' }, { children: text })), jsxRuntime.jsx("div", { className: 'divider__dash' })] })));
44
+ }) }, { children: [jsxRuntime.jsx("div", { className: 'divider__dash' }), Boolean(text) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'divider__text', variant: 'body_small', color: 'secondary' }, { children: text })), jsxRuntime.jsx("div", { className: 'divider__dash' })] }))] })));
45
45
 
46
46
  exports.Divider = Divider;
@@ -2,7 +2,7 @@
2
2
  type Props = {
3
3
  className?: string;
4
4
  fullWidth?: boolean;
5
- text: string;
5
+ text?: string;
6
6
  };
7
7
  export declare const Divider: ({ text, className, fullWidth }: Props) => JSX.Element;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import 'react';
3
3
  import { Typography } from '../Typography/Typography.js';
4
4
  import '@dynamic-labs/sdk-api';
@@ -37,6 +37,6 @@ import 'yup';
37
37
 
38
38
  const Divider = ({ text, className = '', fullWidth = false }) => (jsxs("div", Object.assign({ className: classNames('divider', className, {
39
39
  'divider__full-width': fullWidth,
40
- }) }, { children: [jsx("div", { className: 'divider__dash' }), jsx(Typography, Object.assign({ className: 'divider__text', variant: 'body_small', color: 'secondary' }, { children: text })), jsx("div", { className: 'divider__dash' })] })));
40
+ }) }, { children: [jsx("div", { className: 'divider__dash' }), Boolean(text) && (jsxs(Fragment, { children: [jsx(Typography, Object.assign({ className: 'divider__text', variant: 'body_small', color: 'secondary' }, { children: text })), jsx("div", { className: 'divider__dash' })] }))] })));
41
41
 
42
42
  export { Divider };
@@ -33,8 +33,8 @@ var useWalletUiUtils = require('../../utils/hooks/useWalletUiUtils/useWalletUiUt
33
33
  require('../MockContext/MockContext.cjs');
34
34
  var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
35
35
  require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
36
- var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
37
36
  var ThemeContext = require('../ThemeContext/ThemeContext.cjs');
37
+ var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
38
38
  var useFetchNetworkConfigurations = require('../../utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs');
39
39
  var useMultiWalletWidgetState = require('../../utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.cjs');
40
40
  var useSyncPrimaryWallet = require('../../utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs');
@@ -29,8 +29,8 @@ import { useWalletUiUtils } from '../../utils/hooks/useWalletUiUtils/useWalletUi
29
29
  import '../MockContext/MockContext.js';
30
30
  import { CaptchaContextProvider } from '../CaptchaContext/CaptchaContext.js';
31
31
  import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
32
- import ApiEndpoint from '../../config/ApiEndpoint.js';
33
32
  import { ThemeContextProvider } from '../ThemeContext/ThemeContext.js';
33
+ import ApiEndpoint from '../../config/ApiEndpoint.js';
34
34
  import { useFetchNetworkConfigurations } from '../../utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js';
35
35
  import { useMultiWalletWidgetState } from '../../utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.js';
36
36
  import { useSyncPrimaryWallet } from '../../utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js';
@@ -20,3 +20,5 @@ export { useWalletItemActions } from './useWalletItemActions';
20
20
  export { usePromise } from './usePromise';
21
21
  export { useMutation } from './useMutation';
22
22
  export { useUserUpdateRequest } from './useUserUpdateRequest/useUserUpdateRequest';
23
+ export { useColorSchemePreference } from './useColorSchemePreference';
24
+ export { useGetSocialIcon } from './useGetSocialIcon';
@@ -0,0 +1 @@
1
+ export * from './useColorSchemePreference';
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ const useColorSchemePreference = () => {
8
+ const [preference, setPreference] = React.useState(() => window.matchMedia('(prefers-color-scheme: dark)').matches
9
+ ? 'dark'
10
+ : 'light');
11
+ React.useEffect(() => {
12
+ const listener = (e) => {
13
+ setPreference(e.matches ? 'dark' : 'light');
14
+ };
15
+ window
16
+ .matchMedia('(prefers-color-scheme: dark)')
17
+ .addEventListener('change', listener);
18
+ return () => {
19
+ window
20
+ .matchMedia('(prefers-color-scheme: dark)')
21
+ .removeEventListener('change', listener);
22
+ };
23
+ }, []);
24
+ return preference;
25
+ };
26
+
27
+ exports.useColorSchemePreference = useColorSchemePreference;
@@ -0,0 +1 @@
1
+ export declare const useColorSchemePreference: () => "dark" | "light";
@@ -0,0 +1,23 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ const useColorSchemePreference = () => {
4
+ const [preference, setPreference] = useState(() => window.matchMedia('(prefers-color-scheme: dark)').matches
5
+ ? 'dark'
6
+ : 'light');
7
+ useEffect(() => {
8
+ const listener = (e) => {
9
+ setPreference(e.matches ? 'dark' : 'light');
10
+ };
11
+ window
12
+ .matchMedia('(prefers-color-scheme: dark)')
13
+ .addEventListener('change', listener);
14
+ return () => {
15
+ window
16
+ .matchMedia('(prefers-color-scheme: dark)')
17
+ .removeEventListener('change', listener);
18
+ };
19
+ }, []);
20
+ return preference;
21
+ };
22
+
23
+ export { useColorSchemePreference };
@@ -7,6 +7,7 @@ var utils = require('@dynamic-labs/utils');
7
7
  var api = require('../../../data/api.cjs');
8
8
  require('@dynamic-labs/sdk-api');
9
9
  require('../../../shared/logger.cjs');
10
+ var getFromLS = require('../../../shared/utils/functions/storage/getFromLS.cjs');
10
11
  require('@dynamic-labs/iconic');
11
12
  require('@dynamic-labs/wallet-connector-core');
12
13
  require('react/jsx-runtime');
@@ -46,7 +47,8 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
46
47
  }
47
48
  }, [environmentId, handleRemoveLsNetworks, lsNetworks, removeLsNetworks]);
48
49
  React.useEffect(() => {
49
- if (!authToken) {
50
+ const connectedWalletData = getFromLS.getFromLS(localStorage.CONNECTED_WALLET_CONNECTOR_DATA);
51
+ if (!authToken && !connectedWalletData) {
50
52
  handleRemoveLsNetworks();
51
53
  }
52
54
  }, [authToken, handleRemoveLsNetworks]);
@@ -3,11 +3,12 @@ import { DynamicError } from '@dynamic-labs/utils';
3
3
  import { fetchNetworkSettings } from '../../../data/api.js';
4
4
  import '@dynamic-labs/sdk-api';
5
5
  import '../../../shared/logger.js';
6
+ import { getFromLS } from '../../../shared/utils/functions/storage/getFromLS.js';
6
7
  import '@dynamic-labs/iconic';
7
8
  import '@dynamic-labs/wallet-connector-core';
8
9
  import 'react/jsx-runtime';
9
10
  import '../../../context/ViewContext/ViewContext.js';
10
- import { NETWORKS_STORAGE_KEY } from '../../constants/localStorage.js';
11
+ import { NETWORKS_STORAGE_KEY, CONNECTED_WALLET_CONNECTOR_DATA } from '../../constants/localStorage.js';
11
12
  import '../../constants/colors.js';
12
13
  import 'ethers';
13
14
  import { useLocalStorage } from '../../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
@@ -42,7 +43,8 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
42
43
  }
43
44
  }, [environmentId, handleRemoveLsNetworks, lsNetworks, removeLsNetworks]);
44
45
  useEffect(() => {
45
- if (!authToken) {
46
+ const connectedWalletData = getFromLS(CONNECTED_WALLET_CONNECTOR_DATA);
47
+ if (!authToken && !connectedWalletData) {
46
48
  handleRemoveLsNetworks();
47
49
  }
48
50
  }, [authToken, handleRemoveLsNetworks]);
@@ -0,0 +1 @@
1
+ export * from './useGetSocialIcon';
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var iconic = require('@dynamic-labs/iconic');
7
+ var ThemeContext = require('../../../context/ThemeContext/ThemeContext.cjs');
8
+ var useColorSchemePreference = require('../useColorSchemePreference/useColorSchemePreference.cjs');
9
+
10
+ const useGetSocialIcon = () => {
11
+ const { theme: { theme: { name }, }, } = ThemeContext.useThemeContext();
12
+ const preference = useColorSchemePreference.useColorSchemePreference();
13
+ const variant = name === 'auto' ? preference : name;
14
+ return React.useCallback((provider) => iconic.getSocialIcon(provider, variant), [variant]);
15
+ };
16
+
17
+ exports.useGetSocialIcon = useGetSocialIcon;
@@ -0,0 +1,2 @@
1
+ import { SocialProvider } from '@dynamic-labs/wallet-connector-core';
2
+ export declare const useGetSocialIcon: () => (provider: SocialProvider) => import("@dynamic-labs/iconic").Iconic;
@@ -0,0 +1,13 @@
1
+ import { useCallback } from 'react';
2
+ import { getSocialIcon } from '@dynamic-labs/iconic';
3
+ import { useThemeContext } from '../../../context/ThemeContext/ThemeContext.js';
4
+ import { useColorSchemePreference } from '../useColorSchemePreference/useColorSchemePreference.js';
5
+
6
+ const useGetSocialIcon = () => {
7
+ const { theme: { theme: { name }, }, } = useThemeContext();
8
+ const preference = useColorSchemePreference();
9
+ const variant = name === 'auto' ? preference : name;
10
+ return useCallback((provider) => getSocialIcon(provider, variant), [variant]);
11
+ };
12
+
13
+ export { useGetSocialIcon };
@@ -17,25 +17,29 @@ require('ethers');
17
17
  var isWalletConnected = require('../../functions/isWalletConnected/isWalletConnected.cjs');
18
18
  require('../../../shared/consts/index.cjs');
19
19
 
20
+ const connectedWalletStateReducer = (state, connectedWalletsMap) => {
21
+ const isConnectedWalletsMapEmpty = Object.values(connectedWalletsMap).length === 0;
22
+ if (isConnectedWalletsMapEmpty && state.didLoad === false) {
23
+ return state;
24
+ }
25
+ return Object.assign(Object.assign({}, state), { connectedWalletsMap, didLoad: true });
26
+ };
20
27
  const useWalletsConnectionState = (linkedWallets) => {
21
- const [connectedWalletMap, setConnectedWalletMap] = React.useState();
28
+ const [state, setState] = React.useReducer(connectedWalletStateReducer, {
29
+ connectedWalletsMap: {},
30
+ didLoad: false,
31
+ });
22
32
  const computeConnectedStateForWallets = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
23
- const connectedWalletIds = (yield Promise.all(linkedWallets.map((wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
24
- const isConnected = yield isWalletConnected.isWalletConnected(wallet);
25
- if (isConnected) {
26
- return wallet.id;
27
- }
28
- else {
29
- return undefined;
30
- }
31
- })))).filter((connectedWalletId) => connectedWalletId !== undefined);
32
- const newConnectedStateByWalletIdMap = connectedWalletIds.reduce((result, walletId) => (Object.assign(Object.assign({}, result), { [walletId]: true })), {});
33
- setConnectedWalletMap(newConnectedStateByWalletIdMap);
34
- }), [linkedWallets, setConnectedWalletMap]);
33
+ const connectedWalletsMap = {};
34
+ yield Promise.all(linkedWallets.map((wallet) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
35
+ connectedWalletsMap[wallet.id] = yield isWalletConnected.isWalletConnected(wallet);
36
+ })));
37
+ setState(connectedWalletsMap);
38
+ }), [linkedWallets, setState]);
35
39
  return {
36
40
  computeConnectedStateForWallets,
37
- connectedWalletMap: connectedWalletMap !== null && connectedWalletMap !== void 0 ? connectedWalletMap : {},
38
- didConnectedStateLoad: Boolean(connectedWalletMap),
41
+ connectedWalletMap: state.connectedWalletsMap,
42
+ didConnectedStateLoad: state.didLoad,
39
43
  };
40
44
  };
41
45
 
@@ -1,11 +1,14 @@
1
1
  import { Wallet } from '../../../shared';
2
- type ConnectedWalletsMap = {
3
- [address: string]: boolean;
2
+ type ConnectedState = {
3
+ didLoad: boolean;
4
+ connectedWalletsMap: {
5
+ [address: string]: boolean;
6
+ };
4
7
  };
5
8
  type WalletsConnectionStateHook = (wallets: Wallet[]) => {
6
9
  computeConnectedStateForWallets: () => Promise<void>;
7
- connectedWalletMap: ConnectedWalletsMap;
8
- didConnectedStateLoad: boolean;
10
+ connectedWalletMap: ConnectedState['connectedWalletsMap'];
11
+ didConnectedStateLoad: ConnectedState['didLoad'];
9
12
  };
10
13
  export declare const useWalletsConnectionState: WalletsConnectionStateHook;
11
14
  export {};
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
- import { useState, useCallback } from 'react';
2
+ import { useReducer, useCallback } from 'react';
3
3
  import '../../constants/colors.js';
4
4
  import '@dynamic-labs/multi-wallet';
5
5
  import '@dynamic-labs/utils';
@@ -13,25 +13,29 @@ import 'ethers';
13
13
  import { isWalletConnected } from '../../functions/isWalletConnected/isWalletConnected.js';
14
14
  import '../../../shared/consts/index.js';
15
15
 
16
+ const connectedWalletStateReducer = (state, connectedWalletsMap) => {
17
+ const isConnectedWalletsMapEmpty = Object.values(connectedWalletsMap).length === 0;
18
+ if (isConnectedWalletsMapEmpty && state.didLoad === false) {
19
+ return state;
20
+ }
21
+ return Object.assign(Object.assign({}, state), { connectedWalletsMap, didLoad: true });
22
+ };
16
23
  const useWalletsConnectionState = (linkedWallets) => {
17
- const [connectedWalletMap, setConnectedWalletMap] = useState();
24
+ const [state, setState] = useReducer(connectedWalletStateReducer, {
25
+ connectedWalletsMap: {},
26
+ didLoad: false,
27
+ });
18
28
  const computeConnectedStateForWallets = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
19
- const connectedWalletIds = (yield Promise.all(linkedWallets.map((wallet) => __awaiter(void 0, void 0, void 0, function* () {
20
- const isConnected = yield isWalletConnected(wallet);
21
- if (isConnected) {
22
- return wallet.id;
23
- }
24
- else {
25
- return undefined;
26
- }
27
- })))).filter((connectedWalletId) => connectedWalletId !== undefined);
28
- const newConnectedStateByWalletIdMap = connectedWalletIds.reduce((result, walletId) => (Object.assign(Object.assign({}, result), { [walletId]: true })), {});
29
- setConnectedWalletMap(newConnectedStateByWalletIdMap);
30
- }), [linkedWallets, setConnectedWalletMap]);
29
+ const connectedWalletsMap = {};
30
+ yield Promise.all(linkedWallets.map((wallet) => __awaiter(void 0, void 0, void 0, function* () {
31
+ connectedWalletsMap[wallet.id] = yield isWalletConnected(wallet);
32
+ })));
33
+ setState(connectedWalletsMap);
34
+ }), [linkedWallets, setState]);
31
35
  return {
32
36
  computeConnectedStateForWallets,
33
- connectedWalletMap: connectedWalletMap !== null && connectedWalletMap !== void 0 ? connectedWalletMap : {},
34
- didConnectedStateLoad: Boolean(connectedWalletMap),
37
+ connectedWalletMap: state.connectedWalletsMap,
38
+ didConnectedStateLoad: state.didLoad,
35
39
  };
36
40
  };
37
41
 
@@ -40,19 +40,20 @@ require('../../../../context/MockContext/MockContext.cjs');
40
40
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
41
41
  var useMutation = require('../../../../utils/hooks/useMutation/useMutation.cjs');
42
42
  require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
43
+ var useGetSocialIcon = require('../../../../utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs');
43
44
  var IconListTile = require('../../../../components/IconListTile/IconListTile.cjs');
44
45
  require('../../../../components/Popper/Popper/Popper.cjs');
45
46
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
46
47
  require('formik');
47
48
  require('yup');
48
49
  var SocialRedirectContext = require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
49
- var getSocialIcon = require('../../../../utils/functions/getSocialIcon/getSocialIcon.cjs');
50
50
  var OverlayCard = require('../../../../components/OverlayCard/OverlayCard.cjs');
51
51
  require('../../../../components/OverlayCard/OverlayCard.context.cjs');
52
52
  var capitalize = require('../../../../shared/utils/functions/capitalize/capitalize.cjs');
53
53
 
54
54
  const SocialSignIn = () => {
55
55
  const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = SocialRedirectContext.useSocialRedirectContext();
56
+ const getSocialIcon = useGetSocialIcon.useGetSocialIcon();
56
57
  const [showCard, setShowCard] = React.useState(false);
57
58
  const closeCard = () => !isLoading && setShowCard(false);
58
59
  const numberOfEnabledSocialProviders = enabledSocialProviders.length;
@@ -70,7 +71,7 @@ const SocialSignIn = () => {
70
71
  const closeButton = (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ onClick: closeCard, type: 'button', id: 'close-button', disabled: isLoading, "data-testid": 'close-button' }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
71
72
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in', style: {
72
73
  '--number-of-social-grid-items': numberOfSocialGridItems,
73
- } }, { children: [socialProvidersToDisplayInline.map((provider) => (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: `inline-${provider}`, onClick: () => onClickProvider(provider), className: 'social-sign-in--tile' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon.getSocialIcon(provider), isSpinning: socialProvider === provider, iconSize: 32 }), showConnectText && (jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with ", capitalize.capitalize(provider)] })))] }), provider))), showCardButton && (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true) }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary' }, { children: jsxRuntime.jsx(dotsHorizontal.ReactComponent, {}) })) }), 'show-more-options'))] })), jsxRuntime.jsx(OverlayCard.OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsxRuntime.jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: enabledSocialProviders.map((provider) => (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: `card-${provider}`, onClick: () => onClickProvider(provider), className: 'social-sign-in--card--tile' }, { children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon.getSocialIcon(provider), isSpinning: socialProvider === provider, iconSize: 32 }) }), provider))) }))] })) }))] }));
74
+ } }, { children: [socialProvidersToDisplayInline.map((provider) => (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: `inline-${provider}`, onClick: () => onClickProvider(provider), className: 'social-sign-in--tile' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon(provider), isSpinning: socialProvider === provider, iconSize: 32 }), showConnectText && (jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with ", capitalize.capitalize(provider)] })))] }), provider))), showCardButton && (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true) }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary' }, { children: jsxRuntime.jsx(dotsHorizontal.ReactComponent, {}) })) }), 'show-more-options'))] })), jsxRuntime.jsx(OverlayCard.OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsxRuntime.jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: enabledSocialProviders.map((provider) => (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: `card-${provider}`, onClick: () => onClickProvider(provider), className: 'social-sign-in--card--tile' }, { children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon(provider), isSpinning: socialProvider === provider, iconSize: 32 }) }), provider))) }))] })) }))] }));
74
75
  };
75
76
 
76
77
  exports.SocialSignIn = SocialSignIn;
@@ -36,19 +36,20 @@ import '../../../../context/MockContext/MockContext.js';
36
36
  import '../../../../context/CaptchaContext/CaptchaContext.js';
37
37
  import { useMutation } from '../../../../utils/hooks/useMutation/useMutation.js';
38
38
  import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
39
+ import { useGetSocialIcon } from '../../../../utils/hooks/useGetSocialIcon/useGetSocialIcon.js';
39
40
  import { IconListTile } from '../../../../components/IconListTile/IconListTile.js';
40
41
  import '../../../../components/Popper/Popper/Popper.js';
41
42
  import '../../../../components/Popper/PopperContext/PopperContext.js';
42
43
  import 'formik';
43
44
  import 'yup';
44
45
  import { useSocialRedirectContext } from '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
45
- import { getSocialIcon } from '../../../../utils/functions/getSocialIcon/getSocialIcon.js';
46
46
  import { OverlayCard } from '../../../../components/OverlayCard/OverlayCard.js';
47
47
  import '../../../../components/OverlayCard/OverlayCard.context.js';
48
48
  import { capitalize } from '../../../../shared/utils/functions/capitalize/capitalize.js';
49
49
 
50
50
  const SocialSignIn = () => {
51
51
  const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = useSocialRedirectContext();
52
+ const getSocialIcon = useGetSocialIcon();
52
53
  const [showCard, setShowCard] = useState(false);
53
54
  const closeCard = () => !isLoading && setShowCard(false);
54
55
  const numberOfEnabledSocialProviders = enabledSocialProviders.length;
@@ -35,22 +35,23 @@ require('../../components/Alert/Alert.cjs');
35
35
  require('../../context/MockContext/MockContext.cjs');
36
36
  require('../../context/CaptchaContext/CaptchaContext.cjs');
37
37
  require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
38
+ var useGetSocialIcon = require('../../utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs');
38
39
  var TosAndPp = require('../../components/TosAndPp/TosAndPp.cjs');
39
40
  require('../../components/Popper/Popper/Popper.cjs');
40
41
  require('../../components/Popper/PopperContext/PopperContext.cjs');
41
42
  require('formik');
42
43
  require('yup');
43
44
  var SocialRedirectContext = require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
44
- var getSocialIcon = require('../../utils/functions/getSocialIcon/getSocialIcon.cjs');
45
45
 
46
46
  const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
47
47
  const SocialRedirectView = () => {
48
48
  const { socialProvider, socialWalletConnector } = SocialRedirectContext.useSocialRedirectContext();
49
+ const getSocialIcon = useGetSocialIcon.useGetSocialIcon();
49
50
  const { termsOfServiceUrl, privacyPolicyUrl, isAuthenticated } = useInternalDynamicContext.useInternalDynamicContext();
50
51
  if (!socialWalletConnector || !socialProvider) {
51
52
  return null;
52
53
  }
53
- return (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('social-redirect-view__container') }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { iconSize: 64, Icon: getSocialIcon.getSocialIcon(socialProvider), isSpinning: true }), jsxRuntime.jsxs(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: classNames.classNames('social-redirect-view__title') }, { children: ["Connecting to ", capitalize(socialProvider), "..."] })), jsxRuntime.jsx(TosAndPp.TosAndPp, { mode: isAuthenticated ? 'connecting' : 'logging in', privacyPolicyUrl: privacyPolicyUrl, termsOfServiceUrl: termsOfServiceUrl })] })));
54
+ return (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('social-redirect-view__container') }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { iconSize: 64, Icon: getSocialIcon(socialProvider), isSpinning: true }), jsxRuntime.jsxs(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: classNames.classNames('social-redirect-view__title') }, { children: ["Connecting to ", capitalize(socialProvider), "..."] })), jsxRuntime.jsx(TosAndPp.TosAndPp, { mode: isAuthenticated ? 'connecting' : 'logging in', privacyPolicyUrl: privacyPolicyUrl, termsOfServiceUrl: termsOfServiceUrl })] })));
54
55
  };
55
56
 
56
57
  exports.SocialRedirectView = SocialRedirectView;
@@ -31,17 +31,18 @@ import '../../components/Alert/Alert.js';
31
31
  import '../../context/MockContext/MockContext.js';
32
32
  import '../../context/CaptchaContext/CaptchaContext.js';
33
33
  import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
34
+ import { useGetSocialIcon } from '../../utils/hooks/useGetSocialIcon/useGetSocialIcon.js';
34
35
  import { TosAndPp } from '../../components/TosAndPp/TosAndPp.js';
35
36
  import '../../components/Popper/Popper/Popper.js';
36
37
  import '../../components/Popper/PopperContext/PopperContext.js';
37
38
  import 'formik';
38
39
  import 'yup';
39
40
  import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
40
- import { getSocialIcon } from '../../utils/functions/getSocialIcon/getSocialIcon.js';
41
41
 
42
42
  const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
43
43
  const SocialRedirectView = () => {
44
44
  const { socialProvider, socialWalletConnector } = useSocialRedirectContext();
45
+ const getSocialIcon = useGetSocialIcon();
45
46
  const { termsOfServiceUrl, privacyPolicyUrl, isAuthenticated } = useInternalDynamicContext();
46
47
  if (!socialWalletConnector || !socialProvider) {
47
48
  return null;
@@ -36,19 +36,20 @@ require('../../components/Alert/Alert.cjs');
36
36
  require('../../context/MockContext/MockContext.cjs');
37
37
  require('../../context/CaptchaContext/CaptchaContext.cjs');
38
38
  require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
39
+ var useGetSocialIcon = require('../../utils/hooks/useGetSocialIcon/useGetSocialIcon.cjs');
39
40
  require('../../components/Popper/Popper/Popper.cjs');
40
41
  require('../../components/Popper/PopperContext/PopperContext.cjs');
41
42
  require('formik');
42
43
  require('yup');
43
44
  var SocialRedirectContext = require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
44
- var getSocialIcon = require('../../utils/functions/getSocialIcon/getSocialIcon.cjs');
45
45
 
46
46
  const SocialWrongAccountView = () => {
47
47
  const [tryAgainClicked, setTryAgainClicked] = React.useState(false);
48
48
  const { socialWalletConnector, socialAccount } = SocialRedirectContext.useSocialRedirectContext();
49
+ const getSocialIcon = useGetSocialIcon.useGetSocialIcon();
49
50
  if (!socialAccount || !socialWalletConnector)
50
51
  return null;
51
- return (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('social-wrong-account-view__container') }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon.getSocialIcon(socialAccount.oauthProvider), isSpinning: tryAgainClicked, iconSize: 64 }), jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: classNames.classNames('social-wrong-account-view__title') }, { children: "Whoops. Wrong Account" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames.classNames('social-wrong-account-view__copy') }, { children: "You must connect with the same account you originally signed in with." })), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames.classNames('social-wrong-account-view__copy') }, { children: ["Please connect with: ", jsxRuntime.jsx("b", { children: socialAccount.oauthUsername })] })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'social-wrong-account-view__button', buttonRounded: 'medium', buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
52
+ return (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('social-wrong-account-view__container') }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: getSocialIcon(socialAccount.oauthProvider), isSpinning: tryAgainClicked, iconSize: 64 }), jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: classNames.classNames('social-wrong-account-view__title') }, { children: "Whoops. Wrong Account" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames.classNames('social-wrong-account-view__copy') }, { children: "You must connect with the same account you originally signed in with." })), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames.classNames('social-wrong-account-view__copy') }, { children: ["Please connect with: ", jsxRuntime.jsx("b", { children: socialAccount.oauthUsername })] })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'social-wrong-account-view__button', buttonRounded: 'medium', buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
52
53
  variant: 'button_primary',
53
54
  weight: 'medium',
54
55
  }, disabled: tryAgainClicked, onClick: () => {
@@ -32,16 +32,17 @@ import '../../components/Alert/Alert.js';
32
32
  import '../../context/MockContext/MockContext.js';
33
33
  import '../../context/CaptchaContext/CaptchaContext.js';
34
34
  import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
35
+ import { useGetSocialIcon } from '../../utils/hooks/useGetSocialIcon/useGetSocialIcon.js';
35
36
  import '../../components/Popper/Popper/Popper.js';
36
37
  import '../../components/Popper/PopperContext/PopperContext.js';
37
38
  import 'formik';
38
39
  import 'yup';
39
40
  import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
40
- import { getSocialIcon } from '../../utils/functions/getSocialIcon/getSocialIcon.js';
41
41
 
42
42
  const SocialWrongAccountView = () => {
43
43
  const [tryAgainClicked, setTryAgainClicked] = useState(false);
44
44
  const { socialWalletConnector, socialAccount } = useSocialRedirectContext();
45
+ const getSocialIcon = useGetSocialIcon();
45
46
  if (!socialAccount || !socialWalletConnector)
46
47
  return null;
47
48
  return (jsxs("div", Object.assign({ className: classNames('social-wrong-account-view__container') }, { children: [jsx(IconWithSpinner, { Icon: getSocialIcon(socialAccount.oauthProvider), isSpinning: tryAgainClicked, iconSize: 64 }), jsx(Typography, Object.assign({ weight: 'medium', variant: 'title', className: classNames('social-wrong-account-view__title') }, { children: "Whoops. Wrong Account" })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames('social-wrong-account-view__copy') }, { children: "You must connect with the same account you originally signed in with." })), jsxs(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', className: classNames('social-wrong-account-view__copy') }, { children: ["Please connect with: ", jsx("b", { children: socialAccount.oauthUsername })] })), jsx(Button, Object.assign({ buttonClassName: 'social-wrong-account-view__button', buttonRounded: 'medium', buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var iconic = require('@dynamic-labs/iconic');
6
-
7
- const socialIconMap = {
8
- apple: iconic.AppleIcon,
9
- bitbucket: iconic.BitbucketIcon,
10
- discord: iconic.DiscordIcon,
11
- facebook: iconic.FacebookIcon,
12
- github: iconic.GithubIcon,
13
- gitlab: iconic.GitlabIcon,
14
- google: iconic.GoogleIcon,
15
- linkedin: iconic.LinkedinIcon,
16
- microsoft: iconic.MicrosoftIcon,
17
- twitch: iconic.TwitchIcon,
18
- twitter: iconic.TwitterIcon,
19
- };
20
- const getSocialIcon = (provider) => socialIconMap[provider];
21
-
22
- exports.getSocialIcon = getSocialIcon;
@@ -1,3 +0,0 @@
1
- import { Iconic } from '@dynamic-labs/iconic';
2
- import { SocialProvider } from '@dynamic-labs/wallet-connector-core';
3
- export declare const getSocialIcon: (provider: SocialProvider) => Iconic;
@@ -1,18 +0,0 @@
1
- import { AppleIcon, BitbucketIcon, DiscordIcon, FacebookIcon, GithubIcon, GitlabIcon, GoogleIcon, LinkedinIcon, MicrosoftIcon, TwitchIcon, TwitterIcon } from '@dynamic-labs/iconic';
2
-
3
- const socialIconMap = {
4
- apple: AppleIcon,
5
- bitbucket: BitbucketIcon,
6
- discord: DiscordIcon,
7
- facebook: FacebookIcon,
8
- github: GithubIcon,
9
- gitlab: GitlabIcon,
10
- google: GoogleIcon,
11
- linkedin: LinkedinIcon,
12
- microsoft: MicrosoftIcon,
13
- twitch: TwitchIcon,
14
- twitter: TwitterIcon,
15
- };
16
- const getSocialIcon = (provider) => socialIconMap[provider];
17
-
18
- export { getSocialIcon };
@@ -1 +0,0 @@
1
- export * from './getSocialIcon';