@dynamic-labs/sdk-react-core 3.1.4 → 3.2.0
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 +13 -1
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +15 -8
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +15 -8
- package/src/lib/locale/en/translation.cjs +43 -24
- package/src/lib/locale/en/translation.d.ts +43 -24
- package/src/lib/locale/en/translation.js +43 -24
- package/src/lib/shared/assets/connected-apps.cjs +64 -0
- package/src/lib/shared/assets/connected-apps.js +40 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +3 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.cjs +4 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.js +4 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +8 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +9 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +19 -14
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.js +4 -1
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.cjs +180 -0
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.d.ts +12 -0
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.js +175 -0
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +7 -9
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +7 -9
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +17 -8
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +17 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import { SocialAuthMode } from '../../hooks/useSocialAuth';
|
|
2
3
|
export declare const SOCIAL_STORAGE_KEY = "dynamic_social_storage";
|
|
3
4
|
export type SocialStorageItem = {
|
|
4
5
|
provider: ProviderEnum;
|
|
@@ -10,6 +11,8 @@ export type SocialStorageItem = {
|
|
|
10
11
|
captchaToken?: string;
|
|
11
12
|
/** Oauth code from redirect from oauth provider, this will be provided on response from redirect endpoint **/
|
|
12
13
|
code?: string;
|
|
14
|
+
/** Social auth mode, either sign-in or link */
|
|
15
|
+
mode: SocialAuthMode;
|
|
13
16
|
};
|
|
14
17
|
export type SocialStorage = Partial<Record<ProviderEnum, SocialStorageItem>>;
|
|
15
18
|
export declare const searchSocialStorageByState: (targetState: string) => SocialStorageItem | undefined;
|
|
@@ -369,6 +369,7 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
369
369
|
socialStorage.setSocialStorageFor(provider, {
|
|
370
370
|
captchaToken,
|
|
371
371
|
codeVerifier: usingPkce ? verifier : undefined,
|
|
372
|
+
mode: authMode,
|
|
372
373
|
state,
|
|
373
374
|
});
|
|
374
375
|
const loginUrlString = getOauthLoginUrl.getOauthLoginUrl((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _d !== void 0 ? _d : [], provider);
|
|
@@ -365,6 +365,7 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
365
365
|
setSocialStorageFor(provider, {
|
|
366
366
|
captchaToken,
|
|
367
367
|
codeVerifier: usingPkce ? verifier : undefined,
|
|
368
|
+
mode: authMode,
|
|
368
369
|
state,
|
|
369
370
|
});
|
|
370
371
|
const loginUrlString = getOauthLoginUrl((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _d !== void 0 ? _d : [], provider);
|
|
@@ -13,8 +13,10 @@ var ManagePasskeysWidgetView = require('../../views/ManagePasskeysWidgetView/Man
|
|
|
13
13
|
var SettingsView = require('../../views/SettingsView/SettingsView.cjs');
|
|
14
14
|
var ManageMfaWidgetView = require('../../views/ManageMfaWidgetView/ManageMfaWidgetView.cjs');
|
|
15
15
|
var GlobalWalletView = require('../../views/GlobalWalletView/GlobalWalletView.cjs');
|
|
16
|
+
var ConnectedAppsView = require('../../views/ConnectedAppsView/ConnectedAppsView.cjs');
|
|
16
17
|
|
|
17
18
|
const mapViewToComponent = {
|
|
19
|
+
'connected-apps': ConnectedAppsView.ConnectedAppsView,
|
|
18
20
|
'edit-profile': EditProfileView.EditProfileView,
|
|
19
21
|
'global-wallet': GlobalWalletView.GlobalWalletView,
|
|
20
22
|
'manage-mfa': ManageMfaWidgetView.ManageMfaWidgetView,
|
|
@@ -25,9 +27,9 @@ const mapViewToComponent = {
|
|
|
25
27
|
wallets: WalletsView.WalletsView,
|
|
26
28
|
};
|
|
27
29
|
const DynamicWidgetViews = () => {
|
|
28
|
-
const { dynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
30
|
+
const { dynamicWidgetView, viewProps } = DynamicWidgetContext.useWidgetContext();
|
|
29
31
|
const ViewComponent = mapViewToComponent[dynamicWidgetView] || mapViewToComponent.wallets;
|
|
30
|
-
return jsxRuntime.jsx(ViewComponent, {});
|
|
32
|
+
return jsxRuntime.jsx(ViewComponent, Object.assign({}, viewProps));
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
exports.DynamicWidgetViews = DynamicWidgetViews;
|
|
@@ -9,8 +9,10 @@ import { ManagePasskeysWidgetView } from '../../views/ManagePasskeysWidgetView/M
|
|
|
9
9
|
import { SettingsView } from '../../views/SettingsView/SettingsView.js';
|
|
10
10
|
import { ManageMfaWidgetView } from '../../views/ManageMfaWidgetView/ManageMfaWidgetView.js';
|
|
11
11
|
import { GlobalWalletView } from '../../views/GlobalWalletView/GlobalWalletView.js';
|
|
12
|
+
import { ConnectedAppsView } from '../../views/ConnectedAppsView/ConnectedAppsView.js';
|
|
12
13
|
|
|
13
14
|
const mapViewToComponent = {
|
|
15
|
+
'connected-apps': ConnectedAppsView,
|
|
14
16
|
'edit-profile': EditProfileView,
|
|
15
17
|
'global-wallet': GlobalWalletView,
|
|
16
18
|
'manage-mfa': ManageMfaWidgetView,
|
|
@@ -21,9 +23,9 @@ const mapViewToComponent = {
|
|
|
21
23
|
wallets: WalletsView,
|
|
22
24
|
};
|
|
23
25
|
const DynamicWidgetViews = () => {
|
|
24
|
-
const { dynamicWidgetView } = useWidgetContext();
|
|
26
|
+
const { dynamicWidgetView, viewProps } = useWidgetContext();
|
|
25
27
|
const ViewComponent = mapViewToComponent[dynamicWidgetView] || mapViewToComponent.wallets;
|
|
26
|
-
return jsx(ViewComponent, {});
|
|
28
|
+
return jsx(ViewComponent, Object.assign({}, viewProps));
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export { DynamicWidgetViews, mapViewToComponent };
|
|
@@ -100,7 +100,12 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
100
100
|
const availableWalletsContainerRef = React.useRef(null);
|
|
101
101
|
const { setShowDynamicUserProfile, showDynamicUserProfile, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
102
102
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
103
|
-
const { view: dynamicWidgetView, setView
|
|
103
|
+
const { view: dynamicWidgetView, setView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController.useViewController(isKYCEnabled && !multiWallet ? 'profile' : 'wallets');
|
|
104
|
+
const [viewProps, setViewProps] = React.useState({});
|
|
105
|
+
const setDynamicWidgetView = React.useCallback((view, props) => {
|
|
106
|
+
setView(view);
|
|
107
|
+
setViewProps(props || {});
|
|
108
|
+
}, [setView]);
|
|
104
109
|
const goToProfileView = React.useCallback(() => {
|
|
105
110
|
if (isKYCEnabled)
|
|
106
111
|
return setDynamicWidgetView('profile');
|
|
@@ -132,6 +137,7 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
132
137
|
overridenWidgetView,
|
|
133
138
|
setDynamicWidgetView,
|
|
134
139
|
setIsOpen: setShowDynamicUserProfile,
|
|
140
|
+
viewProps,
|
|
135
141
|
widgetRef,
|
|
136
142
|
}), [
|
|
137
143
|
dynamicWidgetView,
|
|
@@ -141,6 +147,7 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
141
147
|
setDynamicWidgetView,
|
|
142
148
|
setShowDynamicUserProfile,
|
|
143
149
|
overridenWidgetView,
|
|
150
|
+
viewProps,
|
|
144
151
|
]);
|
|
145
152
|
return (jsxRuntime.jsx(DynamicWidgetContext.Provider, { value: value, children: children }));
|
|
146
153
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useRef, useCallback, useMemo, useContext } from 'react';
|
|
3
|
+
import { createContext, useRef, useState, useCallback, useMemo, useContext } from 'react';
|
|
4
4
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import '../../../shared/logger.js';
|
|
@@ -96,7 +96,12 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
96
96
|
const availableWalletsContainerRef = useRef(null);
|
|
97
97
|
const { setShowDynamicUserProfile, showDynamicUserProfile, multiWallet } = useInternalDynamicContext();
|
|
98
98
|
const isKYCEnabled = useKYCFlag();
|
|
99
|
-
const { view: dynamicWidgetView, setView
|
|
99
|
+
const { view: dynamicWidgetView, setView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController(isKYCEnabled && !multiWallet ? 'profile' : 'wallets');
|
|
100
|
+
const [viewProps, setViewProps] = useState({});
|
|
101
|
+
const setDynamicWidgetView = useCallback((view, props) => {
|
|
102
|
+
setView(view);
|
|
103
|
+
setViewProps(props || {});
|
|
104
|
+
}, [setView]);
|
|
100
105
|
const goToProfileView = useCallback(() => {
|
|
101
106
|
if (isKYCEnabled)
|
|
102
107
|
return setDynamicWidgetView('profile');
|
|
@@ -128,6 +133,7 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
128
133
|
overridenWidgetView,
|
|
129
134
|
setDynamicWidgetView,
|
|
130
135
|
setIsOpen: setShowDynamicUserProfile,
|
|
136
|
+
viewProps,
|
|
131
137
|
widgetRef,
|
|
132
138
|
}), [
|
|
133
139
|
dynamicWidgetView,
|
|
@@ -137,6 +143,7 @@ const DynamicWidgetContextProvider = ({ children, }) => {
|
|
|
137
143
|
setDynamicWidgetView,
|
|
138
144
|
setShowDynamicUserProfile,
|
|
139
145
|
overridenWidgetView,
|
|
146
|
+
viewProps,
|
|
140
147
|
]);
|
|
141
148
|
return (jsx(DynamicWidgetContext.Provider, { value: value, children: children }));
|
|
142
149
|
};
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
const DynamicSettingsViews = ['settings'];
|
|
7
|
-
const DynamicGlobalWalletViews = [
|
|
7
|
+
const DynamicGlobalWalletViews = [
|
|
8
|
+
'global-wallet',
|
|
9
|
+
'connected-apps',
|
|
10
|
+
];
|
|
8
11
|
const DynamicPasskeyWidgetViews = ['manage-passkeys'];
|
|
9
12
|
const DynamicMfaWidgetViews = ['manage-mfa'];
|
|
10
13
|
const DynamicTransactionsWidgetViews = ['send-balance'];
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
2
|
-
|
|
3
|
-
availableWalletsContainerRef: RefObject<HTMLDivElement>;
|
|
4
|
-
dynamicWidgetView: DynamicWidgetViews;
|
|
5
|
-
goToProfileView: () => void;
|
|
6
|
-
goToInitialDynamicWidgetView: () => void;
|
|
7
|
-
inlineControlsRef: RefObject<HTMLDivElement>;
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
setDynamicWidgetView: Dispatch<SetStateAction<DynamicWidgetViews>>;
|
|
10
|
-
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
11
|
-
widgetRef: RefObject<HTMLDivElement>;
|
|
12
|
-
overridenWidgetView: DynamicWidgetViews;
|
|
13
|
-
}
|
|
2
|
+
import { ConnectedAppsViewProps } from '../views/ConnectedAppsView/ConnectedAppsView';
|
|
14
3
|
export declare const DynamicSettingsViews: readonly ["settings"];
|
|
15
4
|
export type DynamicSettingsType = typeof DynamicSettingsViews[number];
|
|
16
|
-
export declare const DynamicGlobalWalletViews: readonly ["global-wallet"];
|
|
5
|
+
export declare const DynamicGlobalWalletViews: readonly ["global-wallet", "connected-apps"];
|
|
17
6
|
export type DynamicGlobalWalletType = typeof DynamicGlobalWalletViews[number];
|
|
18
7
|
export declare const DynamicPasskeyWidgetViews: readonly ["manage-passkeys"];
|
|
19
8
|
export declare const DynamicMfaWidgetViews: readonly ["manage-mfa"];
|
|
@@ -21,4 +10,20 @@ export type DynamicPasskeyWidgetViewsType = typeof DynamicPasskeyWidgetViews[num
|
|
|
21
10
|
export type DynamicMfaWidgetViewsType = typeof DynamicMfaWidgetViews[number];
|
|
22
11
|
export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
|
|
23
12
|
export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
|
|
24
|
-
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType;
|
|
13
|
+
export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | 'connected-apps';
|
|
14
|
+
export type ViewProps = {
|
|
15
|
+
'connected-apps': ConnectedAppsViewProps;
|
|
16
|
+
};
|
|
17
|
+
export type WidgetContextProps = {
|
|
18
|
+
availableWalletsContainerRef: RefObject<HTMLDivElement>;
|
|
19
|
+
dynamicWidgetView: DynamicWidgetViews;
|
|
20
|
+
goToInitialDynamicWidgetView: () => void;
|
|
21
|
+
goToProfileView: () => void;
|
|
22
|
+
inlineControlsRef: RefObject<HTMLDivElement>;
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
overridenWidgetView: DynamicWidgetViews;
|
|
25
|
+
setDynamicWidgetView: <T extends DynamicWidgetViews>(view: T, props?: T extends keyof ViewProps ? ViewProps[T] : never) => void;
|
|
26
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
27
|
+
widgetRef: RefObject<HTMLDivElement>;
|
|
28
|
+
viewProps: Record<string, unknown>;
|
|
29
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
const DynamicSettingsViews = ['settings'];
|
|
3
|
-
const DynamicGlobalWalletViews = [
|
|
3
|
+
const DynamicGlobalWalletViews = [
|
|
4
|
+
'global-wallet',
|
|
5
|
+
'connected-apps',
|
|
6
|
+
];
|
|
4
7
|
const DynamicPasskeyWidgetViews = ['manage-passkeys'];
|
|
5
8
|
const DynamicMfaWidgetViews = ['manage-mfa'];
|
|
6
9
|
const DynamicTransactionsWidgetViews = ['send-balance'];
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
require('@dynamic-labs/sdk-api-core');
|
|
11
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
|
|
16
|
+
var check = require('../../../../shared/assets/check.cjs');
|
|
17
|
+
var externalLink = require('../../../../shared/assets/externalLink.cjs');
|
|
18
|
+
var unlink = require('../../../../shared/assets/unlink.cjs');
|
|
19
|
+
require('@dynamic-labs/wallet-book');
|
|
20
|
+
require('@dynamic-labs/utils');
|
|
21
|
+
require('../../../../utils/constants/colors.cjs');
|
|
22
|
+
require('../../../../utils/constants/values.cjs');
|
|
23
|
+
require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
24
|
+
require('../../../../shared/consts/index.cjs');
|
|
25
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
26
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
27
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
28
|
+
var useDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
29
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
30
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
31
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
32
|
+
require('@dynamic-labs/multi-wallet');
|
|
33
|
+
require('react-international-phone');
|
|
34
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
35
|
+
require('../../../../store/state/user/user.cjs');
|
|
36
|
+
require('../../../../locale/locale.cjs');
|
|
37
|
+
require('../../../../store/state/projectSettings/projectSettings.cjs');
|
|
38
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
39
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
40
|
+
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
41
|
+
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
42
|
+
require('react-dom');
|
|
43
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
44
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
45
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
46
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
49
|
+
require('yup');
|
|
50
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
51
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
52
|
+
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
53
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
54
|
+
require('@dynamic-labs/rpc-providers');
|
|
55
|
+
require('../../../../store/state/environmentId.cjs');
|
|
56
|
+
require('../../../../store/state/walletConnectorOptions.cjs');
|
|
57
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
58
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
59
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
60
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
61
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
62
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
63
|
+
require('../../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
64
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
65
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
66
|
+
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
67
|
+
require('react-focus-lock');
|
|
68
|
+
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
69
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
70
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
71
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
72
|
+
require('formik');
|
|
73
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
74
|
+
require('../../../../components/Input/Input.cjs');
|
|
75
|
+
require('../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
76
|
+
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
77
|
+
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
78
|
+
require('../../../../../polyfills.cjs');
|
|
79
|
+
require('../../../../context/ErrorBoundary/ErrorBoundaryBase.cjs');
|
|
80
|
+
require('../../../../context/ErrorBoundary/ErrorBoundaryContext.cjs');
|
|
81
|
+
require('../../../DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.cjs');
|
|
82
|
+
require('../../components/DynamicWidgetCard/DynamicWidgetCard.cjs');
|
|
83
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
84
|
+
require('../../../../context/WidgetRegistry/WidgetRegistryContextProvider.cjs');
|
|
85
|
+
require('../../../../context/FundingContext/FundingContext.cjs');
|
|
86
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
87
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
88
|
+
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
89
|
+
require('@hcaptcha/react-hcaptcha');
|
|
90
|
+
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
91
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
92
|
+
require('../../../../context/SendBalanceContext/SendBalanceContext.cjs');
|
|
93
|
+
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
94
|
+
require('../../../../context/ConnectWithOtpContext/constants.cjs');
|
|
95
|
+
require('../../../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
96
|
+
require('../../../../store/state/tokenBalances.cjs');
|
|
97
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
98
|
+
require('qrcode');
|
|
99
|
+
|
|
100
|
+
const ConnectedAppsView = ({ name, }) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const { t } = reactI18next.useTranslation();
|
|
103
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
104
|
+
const { primaryWallet } = useDynamicContext.useDynamicContext();
|
|
105
|
+
const [connectedApps, setConnectedApps] = React.useState([]);
|
|
106
|
+
const [refreshing, setRefreshing] = React.useState(false);
|
|
107
|
+
const [showSuccessMessage, setShowSuccessMessage] = React.useState(false);
|
|
108
|
+
const { globalWallet } = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
const fetchConnectedApps = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
try {
|
|
112
|
+
// poll for 3 seconds for the global wallet to load
|
|
113
|
+
const pollForSessions = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
const startTime = Date.now();
|
|
115
|
+
while (Date.now() - startTime < 3000) {
|
|
116
|
+
try {
|
|
117
|
+
const sessions = yield globalWallet.getConnectedWCSessions();
|
|
118
|
+
if (sessions !== undefined) {
|
|
119
|
+
return sessions;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
// ignore polling error waiting for global wallet to load
|
|
124
|
+
}
|
|
125
|
+
yield new Promise((resolve) => setTimeout(resolve, 100));
|
|
126
|
+
}
|
|
127
|
+
logger.logger.warn('Timeout waiting for sessions');
|
|
128
|
+
return undefined;
|
|
129
|
+
});
|
|
130
|
+
const sessions = yield pollForSessions();
|
|
131
|
+
// when a user logs out on dapp side, refresh the connected apps
|
|
132
|
+
globalWallet.getWeb3Wallet().on('session_delete', () => setRefreshing(!refreshing));
|
|
133
|
+
if (sessions) {
|
|
134
|
+
const apps = Object.values(sessions).map((session) => ({
|
|
135
|
+
icon: session.peer.metadata.icons[0] || '',
|
|
136
|
+
name: session.peer.metadata.name,
|
|
137
|
+
topic: session.topic,
|
|
138
|
+
url: session.peer.metadata.url,
|
|
139
|
+
}));
|
|
140
|
+
setConnectedApps(apps);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
logger.logger.warn('Error fetching connected apps', error);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
fetchConnectedApps();
|
|
148
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
149
|
+
}, [primaryWallet, refreshing]);
|
|
150
|
+
React.useEffect(() => {
|
|
151
|
+
if (name) {
|
|
152
|
+
setShowSuccessMessage(true);
|
|
153
|
+
const timer = setTimeout(() => {
|
|
154
|
+
setShowSuccessMessage(false);
|
|
155
|
+
}, 3000);
|
|
156
|
+
return () => clearTimeout(timer);
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
return;
|
|
160
|
+
}, [name]);
|
|
161
|
+
const handleDisconnect = (topic) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
162
|
+
try {
|
|
163
|
+
yield globalWallet.disconnectWCSession(topic);
|
|
164
|
+
setRefreshing(!refreshing);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
logger.logger.warn('Error disconnecting app', error);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return (jsxRuntime.jsxs("div", { className: 'connected-apps-view', children: [jsxRuntime.jsxs("div", { className: 'header', children: [jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, { className: 'arrow-left-icon' }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', weight: 'medium', color: 'primary', className: 'title', children: t('global_wallet.connected_apps.title') })] }), jsxRuntime.jsx("div", { className: 'subheader', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'medium', color: 'primary', className: 'title', children: t('global_wallet.connected_apps.subtitle') }) }), connectedApps.length > 0 && (jsxRuntime.jsx("ul", { className: 'connected-apps-list', children: connectedApps.map((app) => (jsxRuntime.jsxs("li", { className: 'connected-app-item', children: [jsxRuntime.jsx("img", { src: app.icon, alt: app.name, className: 'app-icon' }), jsxRuntime.jsx("div", { className: 'app-info', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: app.url }) }), jsxRuntime.jsxs("div", { className: 'app-actions', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => window.open(app.url, '_blank'), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsxRuntime.jsx(externalLink.ReactComponent, {}), typographyProps: {
|
|
171
|
+
color: 'secondary',
|
|
172
|
+
variant: 'button_secondary',
|
|
173
|
+
} }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleDisconnect(app.topic), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsxRuntime.jsx(unlink.ReactComponent, {}), typographyProps: {
|
|
174
|
+
color: 'secondary',
|
|
175
|
+
variant: 'button_secondary',
|
|
176
|
+
} })] })] }, app.url))) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', children: t('global_wallet.connected_apps.success', { name }) })] }))] }));
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
exports.ConnectedAppsView = ConnectedAppsView;
|
|
180
|
+
exports["default"] = ConnectedAppsView;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ConnectedApp {
|
|
3
|
+
name: string;
|
|
4
|
+
url: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
topic: string;
|
|
7
|
+
}
|
|
8
|
+
export type ConnectedAppsViewProps = {
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const ConnectedAppsView: React.FC<ConnectedAppsViewProps>;
|
|
12
|
+
export default ConnectedAppsView;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import '@dynamic-labs/sdk-api-core';
|
|
7
|
+
import { logger } from '../../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import { ReactComponent as SvgArrowLeft } from '../../../../shared/assets/arrow-left.js';
|
|
12
|
+
import { ReactComponent as SvgCheck } from '../../../../shared/assets/check.js';
|
|
13
|
+
import { ReactComponent as SvgExternalLink } from '../../../../shared/assets/externalLink.js';
|
|
14
|
+
import { ReactComponent as SvgUnlink } from '../../../../shared/assets/unlink.js';
|
|
15
|
+
import '@dynamic-labs/wallet-book';
|
|
16
|
+
import '@dynamic-labs/utils';
|
|
17
|
+
import '../../../../utils/constants/colors.js';
|
|
18
|
+
import '../../../../utils/constants/values.js';
|
|
19
|
+
import '../../../../store/state/loadingAndLifecycle.js';
|
|
20
|
+
import '../../../../shared/consts/index.js';
|
|
21
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
22
|
+
import '../../../../components/Alert/Alert.js';
|
|
23
|
+
import '../../../../events/dynamicEvents.js';
|
|
24
|
+
import { useDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
25
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
26
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
27
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
28
|
+
import '@dynamic-labs/multi-wallet';
|
|
29
|
+
import 'react-international-phone';
|
|
30
|
+
import '../../../../config/ApiEndpoint.js';
|
|
31
|
+
import '../../../../store/state/user/user.js';
|
|
32
|
+
import '../../../../locale/locale.js';
|
|
33
|
+
import '../../../../store/state/projectSettings/projectSettings.js';
|
|
34
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
35
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
36
|
+
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
37
|
+
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
38
|
+
import 'react-dom';
|
|
39
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
40
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
41
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
42
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
43
|
+
import '@dynamic-labs/types';
|
|
44
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
45
|
+
import 'yup';
|
|
46
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
47
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
48
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
49
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
50
|
+
import '@dynamic-labs/rpc-providers';
|
|
51
|
+
import '../../../../store/state/environmentId.js';
|
|
52
|
+
import '../../../../store/state/walletConnectorOptions.js';
|
|
53
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
54
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
55
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
56
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
57
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
58
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
59
|
+
import '../../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
60
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
61
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
62
|
+
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
63
|
+
import 'react-focus-lock';
|
|
64
|
+
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
65
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
66
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
67
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
68
|
+
import 'formik';
|
|
69
|
+
import '../../../../store/state/sendBalances.js';
|
|
70
|
+
import '../../../../components/Input/Input.js';
|
|
71
|
+
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
72
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
73
|
+
import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
74
|
+
import '../../../../../polyfills.js';
|
|
75
|
+
import '../../../../context/ErrorBoundary/ErrorBoundaryBase.js';
|
|
76
|
+
import '../../../../context/ErrorBoundary/ErrorBoundaryContext.js';
|
|
77
|
+
import '../../../DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
78
|
+
import '../../components/DynamicWidgetCard/DynamicWidgetCard.js';
|
|
79
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
80
|
+
import '../../../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
81
|
+
import '../../../../context/FundingContext/FundingContext.js';
|
|
82
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
83
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
84
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
85
|
+
import '@hcaptcha/react-hcaptcha';
|
|
86
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
87
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
88
|
+
import '../../../../context/SendBalanceContext/SendBalanceContext.js';
|
|
89
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
90
|
+
import '../../../../context/ConnectWithOtpContext/constants.js';
|
|
91
|
+
import '../../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
92
|
+
import '../../../../store/state/tokenBalances.js';
|
|
93
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
94
|
+
import 'qrcode';
|
|
95
|
+
|
|
96
|
+
const ConnectedAppsView = ({ name, }) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const { t } = useTranslation();
|
|
99
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
100
|
+
const { primaryWallet } = useDynamicContext();
|
|
101
|
+
const [connectedApps, setConnectedApps] = useState([]);
|
|
102
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
103
|
+
const [showSuccessMessage, setShowSuccessMessage] = useState(false);
|
|
104
|
+
const { globalWallet } = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _a !== void 0 ? _a : {};
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const fetchConnectedApps = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
try {
|
|
108
|
+
// poll for 3 seconds for the global wallet to load
|
|
109
|
+
const pollForSessions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
const startTime = Date.now();
|
|
111
|
+
while (Date.now() - startTime < 3000) {
|
|
112
|
+
try {
|
|
113
|
+
const sessions = yield globalWallet.getConnectedWCSessions();
|
|
114
|
+
if (sessions !== undefined) {
|
|
115
|
+
return sessions;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// ignore polling error waiting for global wallet to load
|
|
120
|
+
}
|
|
121
|
+
yield new Promise((resolve) => setTimeout(resolve, 100));
|
|
122
|
+
}
|
|
123
|
+
logger.warn('Timeout waiting for sessions');
|
|
124
|
+
return undefined;
|
|
125
|
+
});
|
|
126
|
+
const sessions = yield pollForSessions();
|
|
127
|
+
// when a user logs out on dapp side, refresh the connected apps
|
|
128
|
+
globalWallet.getWeb3Wallet().on('session_delete', () => setRefreshing(!refreshing));
|
|
129
|
+
if (sessions) {
|
|
130
|
+
const apps = Object.values(sessions).map((session) => ({
|
|
131
|
+
icon: session.peer.metadata.icons[0] || '',
|
|
132
|
+
name: session.peer.metadata.name,
|
|
133
|
+
topic: session.topic,
|
|
134
|
+
url: session.peer.metadata.url,
|
|
135
|
+
}));
|
|
136
|
+
setConnectedApps(apps);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
logger.warn('Error fetching connected apps', error);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
fetchConnectedApps();
|
|
144
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
|
+
}, [primaryWallet, refreshing]);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (name) {
|
|
148
|
+
setShowSuccessMessage(true);
|
|
149
|
+
const timer = setTimeout(() => {
|
|
150
|
+
setShowSuccessMessage(false);
|
|
151
|
+
}, 3000);
|
|
152
|
+
return () => clearTimeout(timer);
|
|
153
|
+
}
|
|
154
|
+
else
|
|
155
|
+
return;
|
|
156
|
+
}, [name]);
|
|
157
|
+
const handleDisconnect = (topic) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
+
try {
|
|
159
|
+
yield globalWallet.disconnectWCSession(topic);
|
|
160
|
+
setRefreshing(!refreshing);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
logger.warn('Error disconnecting app', error);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return (jsxs("div", { className: 'connected-apps-view', children: [jsxs("div", { className: 'header', children: [jsx(IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsx(SvgArrowLeft, { className: 'arrow-left-icon' }) }), jsx(Typography, { variant: 'title', weight: 'medium', color: 'primary', className: 'title', children: t('global_wallet.connected_apps.title') })] }), jsx("div", { className: 'subheader', children: jsx(Typography, { variant: 'body_small', weight: 'medium', color: 'primary', className: 'title', children: t('global_wallet.connected_apps.subtitle') }) }), connectedApps.length > 0 && (jsx("ul", { className: 'connected-apps-list', children: connectedApps.map((app) => (jsxs("li", { className: 'connected-app-item', children: [jsx("img", { src: app.icon, alt: app.name, className: 'app-icon' }), jsx("div", { className: 'app-info', children: jsx(Typography, { variant: 'body_normal', color: 'primary', children: app.url }) }), jsxs("div", { className: 'app-actions', children: [jsx(TypographyButton, { onClick: () => window.open(app.url, '_blank'), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsx(SvgExternalLink, {}), typographyProps: {
|
|
167
|
+
color: 'secondary',
|
|
168
|
+
variant: 'button_secondary',
|
|
169
|
+
} }), jsx(TypographyButton, { onClick: () => handleDisconnect(app.topic), buttonVariant: 'tertiary', buttonPadding: 'none', startSlot: jsx(SvgUnlink, {}), typographyProps: {
|
|
170
|
+
color: 'secondary',
|
|
171
|
+
variant: 'button_secondary',
|
|
172
|
+
} })] })] }, app.url))) })), showSuccessMessage && (jsxs("div", { className: 'success-message', children: [jsx(SvgCheck, {}), jsx(Typography, { variant: 'body_small', color: 'primary', children: t('global_wallet.connected_apps.success', { name }) })] }))] }));
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { ConnectedAppsView, ConnectedAppsView as default };
|
|
@@ -118,13 +118,13 @@ const GlobalWalletView = () => {
|
|
|
118
118
|
throw new Error('Global Wallet not found');
|
|
119
119
|
const showBanner = React.useCallback((message, type) => {
|
|
120
120
|
setBannerMessage({ message, type });
|
|
121
|
-
const timeout = type === 'success' ?
|
|
121
|
+
const timeout = type === 'success' ? 0 : 3000;
|
|
122
122
|
setTimeout(() => {
|
|
123
123
|
setBannerMessage(null);
|
|
124
|
-
if (type === 'success')
|
|
125
|
-
goToInitialDynamicWidgetView();
|
|
126
124
|
}, timeout);
|
|
127
|
-
},
|
|
125
|
+
},
|
|
126
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
|
+
[]);
|
|
128
128
|
const handleConfirmView = (pairingInfo) => {
|
|
129
129
|
setView('global-wallet-confirm', {
|
|
130
130
|
onCancel: () => {
|
|
@@ -136,7 +136,7 @@ const GlobalWalletView = () => {
|
|
|
136
136
|
setWalletConnectUri('');
|
|
137
137
|
},
|
|
138
138
|
onConfirm: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
-
var _a
|
|
139
|
+
var _a;
|
|
140
140
|
try {
|
|
141
141
|
yield globalWallet.confirmPairing(true);
|
|
142
142
|
setDynamicWidgetView('global-wallet');
|
|
@@ -144,13 +144,11 @@ const GlobalWalletView = () => {
|
|
|
144
144
|
ignoreIfIsEmbeddedWidget: false,
|
|
145
145
|
performMultiWalletChecks: false,
|
|
146
146
|
});
|
|
147
|
-
|
|
148
|
-
name: (_a = pairingInfo.name) !== null && _a !== void 0 ? _a : t('global_wallet.the_dapp'),
|
|
149
|
-
}), 'success');
|
|
147
|
+
setDynamicWidgetView('connected-apps', { name: pairingInfo.name });
|
|
150
148
|
}
|
|
151
149
|
catch (error) {
|
|
152
150
|
showBanner(t('global_wallet.banner.warning', {
|
|
153
|
-
name: (
|
|
151
|
+
name: (_a = pairingInfo.name) !== null && _a !== void 0 ? _a : t('global_wallet.the_dapp'),
|
|
154
152
|
}), 'error');
|
|
155
153
|
}
|
|
156
154
|
}),
|