@dynamic-labs/sdk-react-core 4.18.7 → 4.19.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 +23 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +7 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +8 -2
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +26 -3
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +27 -4
- package/src/lib/locale/en/translation.cjs +39 -0
- package/src/lib/locale/en/translation.d.ts +39 -0
- package/src/lib/locale/en/translation.js +39 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.cjs +10 -0
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.d.ts +2 -0
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.js +6 -0
- package/src/lib/utils/functions/getSessionInformationName/index.d.ts +1 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.cjs +92 -4
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.js +92 -4
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -3
- package/src/lib/utils/hooks/useSessionKeys/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSessionKeys/useSessionKeys.cjs +140 -0
- package/src/lib/utils/hooks/useSessionKeys/useSessionKeys.d.ts +5 -0
- package/src/lib/utils/hooks/useSessionKeys/useSessionKeys.js +136 -0
- package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs +3 -90
- package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.js +3 -90
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +5 -1
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +5 -1
- package/src/lib/utils/types/SessionInformation.d.ts +25 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ConnectedAppsView/ConnectedAppsView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +51 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +47 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.cjs +31 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js +27 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +15 -2
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.d.ts +7 -1
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +16 -3
|
@@ -14,20 +14,33 @@ var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
|
14
14
|
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
15
15
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
16
16
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
17
|
+
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
18
|
+
var useSessionKeys = require('../../../../utils/hooks/useSessionKeys/useSessionKeys.cjs');
|
|
17
19
|
var EmptySessionsView = require('./EmptySessionsView/EmptySessionsView.cjs');
|
|
20
|
+
var SessionListItem = require('./SessionListItem/SessionListItem.cjs');
|
|
18
21
|
|
|
19
|
-
const SessionManagementView = () => {
|
|
22
|
+
const SessionManagementView = ({ bannerMessage, }) => {
|
|
20
23
|
const { t } = reactI18next.useTranslation();
|
|
21
24
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
25
|
+
const { listSessions } = useSessionKeys.useSessionKeys();
|
|
26
|
+
const [sessions, setSessions] = React.useState([]);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
listSessions().then(setSessions);
|
|
29
|
+
}, [listSessions]);
|
|
22
30
|
const handleBackButtonClick = React.useCallback(() => {
|
|
23
31
|
setDynamicWidgetView('account-and-security-settings');
|
|
24
32
|
}, [setDynamicWidgetView]);
|
|
25
33
|
const handleInfoButtonClick = React.useCallback(() => {
|
|
26
34
|
setDynamicWidgetView('session-management-info');
|
|
27
35
|
}, [setDynamicWidgetView]);
|
|
36
|
+
const handleRevokeAccessClick = React.useCallback((session) => {
|
|
37
|
+
setDynamicWidgetView('session-management-revoke-access', {
|
|
38
|
+
session,
|
|
39
|
+
});
|
|
40
|
+
}, [setDynamicWidgetView]);
|
|
28
41
|
const renderBackButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
29
42
|
const renderInfoButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }));
|
|
30
|
-
return (jsxRuntime.jsxs("div", { className: 'session-management-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsxRuntime.jsx("div", { className: 'session-management-view__body', children: jsxRuntime.jsx(EmptySessionsView.EmptySessionsView, {}) })] }));
|
|
43
|
+
return (jsxRuntime.jsxs("div", { className: 'session-management-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsxRuntime.jsx("div", { className: 'session-management-view__banner', children: bannerMessage && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: bannerMessage.type, withIcon: false, children: bannerMessage.message })) }), jsxRuntime.jsx("div", { className: 'session-management-view__body', children: sessions.length === 0 ? (jsxRuntime.jsx(EmptySessionsView.EmptySessionsView, {})) : (jsxRuntime.jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsxRuntime.jsx(SessionListItem.SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
|
|
31
44
|
};
|
|
32
45
|
|
|
33
46
|
exports.SessionManagementView = SessionManagementView;
|
package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface SessionManagementViewProps {
|
|
3
|
+
bannerMessage?: {
|
|
4
|
+
type: 'success' | 'error';
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const SessionManagementView: FC<SessionManagementViewProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
6
6
|
import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
|
|
@@ -10,20 +10,33 @@ import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
|
10
10
|
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
11
11
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
12
12
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
13
|
+
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
14
|
+
import { useSessionKeys } from '../../../../utils/hooks/useSessionKeys/useSessionKeys.js';
|
|
13
15
|
import { EmptySessionsView } from './EmptySessionsView/EmptySessionsView.js';
|
|
16
|
+
import { SessionListItem } from './SessionListItem/SessionListItem.js';
|
|
14
17
|
|
|
15
|
-
const SessionManagementView = () => {
|
|
18
|
+
const SessionManagementView = ({ bannerMessage, }) => {
|
|
16
19
|
const { t } = useTranslation();
|
|
17
20
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
21
|
+
const { listSessions } = useSessionKeys();
|
|
22
|
+
const [sessions, setSessions] = useState([]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
listSessions().then(setSessions);
|
|
25
|
+
}, [listSessions]);
|
|
18
26
|
const handleBackButtonClick = useCallback(() => {
|
|
19
27
|
setDynamicWidgetView('account-and-security-settings');
|
|
20
28
|
}, [setDynamicWidgetView]);
|
|
21
29
|
const handleInfoButtonClick = useCallback(() => {
|
|
22
30
|
setDynamicWidgetView('session-management-info');
|
|
23
31
|
}, [setDynamicWidgetView]);
|
|
32
|
+
const handleRevokeAccessClick = useCallback((session) => {
|
|
33
|
+
setDynamicWidgetView('session-management-revoke-access', {
|
|
34
|
+
session,
|
|
35
|
+
});
|
|
36
|
+
}, [setDynamicWidgetView]);
|
|
24
37
|
const renderBackButton = () => (jsx(IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsx(SvgChevronLeft, {}) }));
|
|
25
38
|
const renderInfoButton = () => (jsx(IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsx(SvgFooterInfoIcon, {}) }));
|
|
26
|
-
return (jsxs("div", { className: 'session-management-view', children: [jsx(ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsx("div", { className: 'session-management-view__body', children: jsx(EmptySessionsView, {}) })] }));
|
|
39
|
+
return (jsxs("div", { className: 'session-management-view', children: [jsx(ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsx("div", { className: 'session-management-view__banner', children: bannerMessage && (jsx(ErrorContainer, { variant: bannerMessage.type, withIcon: false, children: bannerMessage.message })) }), jsx("div", { className: 'session-management-view__body', children: sessions.length === 0 ? (jsx(EmptySessionsView, {})) : (jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsx(SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
|
|
27
40
|
};
|
|
28
41
|
|
|
29
42
|
export { SessionManagementView };
|