@dynamic-labs/sdk-react-core 4.19.3 → 4.19.4
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 +2 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -1
- package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +6 -0
- package/src/lib/locale/en/translation.cjs +10 -2
- package/src/lib/locale/en/translation.d.ts +9 -1
- package/src/lib/locale/en/translation.js +10 -2
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.cjs +1 -0
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.d.ts +1 -0
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.js +1 -0
- package/src/lib/store/utils/settingsUtils/settingsUtils.d.ts +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getSessionInformation/getSessionInformation.cjs +34 -0
- package/src/lib/utils/functions/getSessionInformation/getSessionInformation.d.ts +11 -0
- package/src/lib/utils/functions/getSessionInformation/getSessionInformation.js +26 -0
- package/src/lib/utils/functions/getSessionInformation/index.d.ts +1 -0
- package/src/lib/views/SessionPermissionsView/SessionPermissionsView.cjs +7 -12
- package/src/lib/views/SessionPermissionsView/SessionPermissionsView.js +7 -12
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.cjs +4 -2
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.d.ts +4 -1
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.js +4 -2
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +12 -8
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +12 -8
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.cjs +97 -6
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js +97 -6
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +6 -2
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +6 -2
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.cjs +0 -10
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.d.ts +0 -2
- package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.js +0 -6
- package/src/lib/utils/functions/getSessionInformationName/index.d.ts +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var shortenWalletAddress = require('../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
7
|
+
var getTimeSince = require('../../../widgets/DynamicWidget/helpers/getTimeSince.cjs');
|
|
8
|
+
|
|
9
|
+
/** Returns the name of the session or the shortened wallet address if no name is available */
|
|
10
|
+
const getSessionInformationName = (session) => { var _a; return (_a = session.origin) !== null && _a !== void 0 ? _a : shortenWalletAddress.shortenWalletAddress(session.sessionId); };
|
|
11
|
+
/** Returns the time since the session was created in a human readable format */
|
|
12
|
+
const getSessionInformationTimeSinceCreation = (session) => {
|
|
13
|
+
const { value, unit } = getTimeSince.getTimeSince(new Date(session.timestamp));
|
|
14
|
+
return `${value} ${unit}`;
|
|
15
|
+
};
|
|
16
|
+
/** Returns the expiration of the session in a human readable format */
|
|
17
|
+
const getSessionInformationExpiration = (session) => {
|
|
18
|
+
const { value, unit } = getTimeSince.getTimeSince(new Date(), new Date(Number(session.session.expiresAt) * 1000));
|
|
19
|
+
return `${value} ${unit}`;
|
|
20
|
+
};
|
|
21
|
+
/** Returns the spending limit of the session in ETH */
|
|
22
|
+
const getSessionInformationSpendingLimit = (session) => {
|
|
23
|
+
const { limit } = session.session.feeLimit;
|
|
24
|
+
const ethString = (Number(limit) / Math.pow(10, 18)).toFixed(6);
|
|
25
|
+
return `~${ethString} ETH`;
|
|
26
|
+
};
|
|
27
|
+
/** Exports the session information as a JSON string with a helper to process bigints */
|
|
28
|
+
const getSessionInformationJson = (session) => JSON.stringify(session, (_, val) => (typeof val === 'bigint' ? val.toString() : val), 2);
|
|
29
|
+
|
|
30
|
+
exports.getSessionInformationExpiration = getSessionInformationExpiration;
|
|
31
|
+
exports.getSessionInformationJson = getSessionInformationJson;
|
|
32
|
+
exports.getSessionInformationName = getSessionInformationName;
|
|
33
|
+
exports.getSessionInformationSpendingLimit = getSessionInformationSpendingLimit;
|
|
34
|
+
exports.getSessionInformationTimeSinceCreation = getSessionInformationTimeSinceCreation;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SessionInformation } from '../../types/SessionInformation';
|
|
2
|
+
/** Returns the name of the session or the shortened wallet address if no name is available */
|
|
3
|
+
export declare const getSessionInformationName: (session: SessionInformation) => string;
|
|
4
|
+
/** Returns the time since the session was created in a human readable format */
|
|
5
|
+
export declare const getSessionInformationTimeSinceCreation: (session: SessionInformation) => string;
|
|
6
|
+
/** Returns the expiration of the session in a human readable format */
|
|
7
|
+
export declare const getSessionInformationExpiration: (session: SessionInformation) => string;
|
|
8
|
+
/** Returns the spending limit of the session in ETH */
|
|
9
|
+
export declare const getSessionInformationSpendingLimit: (session: SessionInformation) => string;
|
|
10
|
+
/** Exports the session information as a JSON string with a helper to process bigints */
|
|
11
|
+
export declare const getSessionInformationJson: (session: SessionInformation) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { shortenWalletAddress } from '../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
3
|
+
import { getTimeSince } from '../../../widgets/DynamicWidget/helpers/getTimeSince.js';
|
|
4
|
+
|
|
5
|
+
/** Returns the name of the session or the shortened wallet address if no name is available */
|
|
6
|
+
const getSessionInformationName = (session) => { var _a; return (_a = session.origin) !== null && _a !== void 0 ? _a : shortenWalletAddress(session.sessionId); };
|
|
7
|
+
/** Returns the time since the session was created in a human readable format */
|
|
8
|
+
const getSessionInformationTimeSinceCreation = (session) => {
|
|
9
|
+
const { value, unit } = getTimeSince(new Date(session.timestamp));
|
|
10
|
+
return `${value} ${unit}`;
|
|
11
|
+
};
|
|
12
|
+
/** Returns the expiration of the session in a human readable format */
|
|
13
|
+
const getSessionInformationExpiration = (session) => {
|
|
14
|
+
const { value, unit } = getTimeSince(new Date(), new Date(Number(session.session.expiresAt) * 1000));
|
|
15
|
+
return `${value} ${unit}`;
|
|
16
|
+
};
|
|
17
|
+
/** Returns the spending limit of the session in ETH */
|
|
18
|
+
const getSessionInformationSpendingLimit = (session) => {
|
|
19
|
+
const { limit } = session.session.feeLimit;
|
|
20
|
+
const ethString = (Number(limit) / Math.pow(10, 18)).toFixed(6);
|
|
21
|
+
return `~${ethString} ETH`;
|
|
22
|
+
};
|
|
23
|
+
/** Exports the session information as a JSON string with a helper to process bigints */
|
|
24
|
+
const getSessionInformationJson = (session) => JSON.stringify(session, (_, val) => (typeof val === 'bigint' ? val.toString() : val), 2);
|
|
25
|
+
|
|
26
|
+
export { getSessionInformationExpiration, getSessionInformationJson, getSessionInformationName, getSessionInformationSpendingLimit, getSessionInformationTimeSinceCreation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getSessionInformation';
|
|
@@ -13,10 +13,10 @@ var Textarea = require('../../components/Textarea/Textarea.cjs');
|
|
|
13
13
|
require('@dynamic-labs/utils');
|
|
14
14
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
15
15
|
var AccordionToggle = require('../../components/Accordion/components/AccordionToggle/AccordionToggle.cjs');
|
|
16
|
-
var getTimeSince = require('../../widgets/DynamicWidget/helpers/getTimeSince.cjs');
|
|
17
16
|
var profileOutline = require('../../shared/assets/profile-outline.cjs');
|
|
18
17
|
var session = require('../../shared/assets/session.cjs');
|
|
19
18
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
19
|
+
var getSessionInformation = require('../../utils/functions/getSessionInformation/getSessionInformation.cjs');
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* A view component to render SessionInformation permissions
|
|
@@ -27,17 +27,12 @@ const SessionPermissionsView = ({ session: session$1, showAdvanced = false, }) =
|
|
|
27
27
|
const toggleAdvancedExpanded = React.useCallback(() => {
|
|
28
28
|
setIsAdvancedExpanded(!isAdvancedExpanded);
|
|
29
29
|
}, [isAdvancedExpanded]);
|
|
30
|
-
const timeToExpire = React.useMemo(() =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [session
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const ethString = (Number(limit) / Math.pow(10, 18)).toFixed(6);
|
|
37
|
-
return `~${ethString} ETH`;
|
|
38
|
-
}, [session$1]);
|
|
39
|
-
const sessionString = React.useMemo(() => JSON.stringify(session$1, (_, val) => (typeof val === 'bigint' ? val.toString() : val), 2), [session$1]);
|
|
40
|
-
return (jsxRuntime.jsxs("div", { className: 'session-permissions-view', children: [jsxRuntime.jsx("div", { className: 'session-permissions-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.permissions_label') }) }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card', children: [jsxRuntime.jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-tertiary', children: jsxRuntime.jsx(profileOutline.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.ownership') })] }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-tertiary', children: jsxRuntime.jsx(session.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: `${t('dyn_session_permissions.permissions.access')} ${timeToExpire}` })] })] }), jsxRuntime.jsx("div", { className: 'session-permissions-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.spending_label') }) }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card session-permissions-view__token-card', children: [jsxRuntime.jsxs("div", { className: 'session-permissions-view__token', children: [jsxRuntime.jsx(Icon.Icon, { size: 'medium', children: jsxRuntime.jsx(iconic.EthereumIcon, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', children: "ETH" })] }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__spending', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.spending_limit') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: spendingLimit })] })] }), showAdvanced && (jsxRuntime.jsxs("div", { className: 'session-permissions-view__panel', children: [jsxRuntime.jsxs(AccordionToggle.AccordionToggle, { className: 'session-permissions-view__panel-toggle', isOpen: isAdvancedExpanded, onClick: toggleAdvancedExpanded, labelClassName: 'session-permissions-view__panel-toggle-label', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.advanced_label') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.advanced_description') })] }), isAdvancedExpanded && (jsxRuntime.jsx("div", { className: 'session-permissions-view__panel-content', children: jsxRuntime.jsx(Textarea.Textarea, { value: sessionString, readOnly: true, rows: 8, id: 'session-permissions-view__raw-json', "data-testid": 'session-permissions-view__raw-json', label: '' }) }))] }))] }));
|
|
30
|
+
const timeToExpire = React.useMemo(() => getSessionInformation.getSessionInformationExpiration(session$1), [session$1]);
|
|
31
|
+
const spendingLimit = React.useMemo(() => getSessionInformation.getSessionInformationSpendingLimit(session$1), [session$1]);
|
|
32
|
+
const sessionString = React.useMemo(() => getSessionInformation.getSessionInformationJson(session$1), [session$1]);
|
|
33
|
+
return (jsxRuntime.jsxs("div", { className: 'session-permissions-view', children: [jsxRuntime.jsx("div", { className: 'session-permissions-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.permissions_label') }) }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card', children: [jsxRuntime.jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-tertiary', children: jsxRuntime.jsx(profileOutline.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.ownership') })] }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-tertiary', children: jsxRuntime.jsx(session.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.access', {
|
|
34
|
+
time: timeToExpire,
|
|
35
|
+
}) })] })] }), jsxRuntime.jsx("div", { className: 'session-permissions-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.spending_label') }) }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__card session-permissions-view__token-card', children: [jsxRuntime.jsxs("div", { className: 'session-permissions-view__token', children: [jsxRuntime.jsx(Icon.Icon, { size: 'medium', children: jsxRuntime.jsx(iconic.EthereumIcon, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', children: "ETH" })] }), jsxRuntime.jsxs("div", { className: 'session-permissions-view__spending', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.spending_limit') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: spendingLimit })] })] }), showAdvanced && (jsxRuntime.jsxs("div", { className: 'session-permissions-view__panel', children: [jsxRuntime.jsxs(AccordionToggle.AccordionToggle, { className: 'session-permissions-view__panel-toggle', isOpen: isAdvancedExpanded, onClick: toggleAdvancedExpanded, labelClassName: 'session-permissions-view__panel-toggle-label', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.advanced_label') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.advanced_description') })] }), isAdvancedExpanded && (jsxRuntime.jsx("div", { className: 'session-permissions-view__panel-content', children: jsxRuntime.jsx(Textarea.Textarea, { value: sessionString, readOnly: true, rows: 8, id: 'session-permissions-view__raw-json', "data-testid": 'session-permissions-view__raw-json', label: '' }) }))] }))] }));
|
|
41
36
|
};
|
|
42
37
|
|
|
43
38
|
exports.SessionPermissionsView = SessionPermissionsView;
|
|
@@ -9,10 +9,10 @@ import { Textarea } from '../../components/Textarea/Textarea.js';
|
|
|
9
9
|
import '@dynamic-labs/utils';
|
|
10
10
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
11
11
|
import { AccordionToggle } from '../../components/Accordion/components/AccordionToggle/AccordionToggle.js';
|
|
12
|
-
import { getTimeSince } from '../../widgets/DynamicWidget/helpers/getTimeSince.js';
|
|
13
12
|
import { ReactComponent as SvgProfileOutline } from '../../shared/assets/profile-outline.js';
|
|
14
13
|
import { ReactComponent as SvgSession } from '../../shared/assets/session.js';
|
|
15
14
|
import '../../context/ViewContext/ViewContext.js';
|
|
15
|
+
import { getSessionInformationExpiration, getSessionInformationSpendingLimit, getSessionInformationJson } from '../../utils/functions/getSessionInformation/getSessionInformation.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A view component to render SessionInformation permissions
|
|
@@ -23,17 +23,12 @@ const SessionPermissionsView = ({ session, showAdvanced = false, }) => {
|
|
|
23
23
|
const toggleAdvancedExpanded = useCallback(() => {
|
|
24
24
|
setIsAdvancedExpanded(!isAdvancedExpanded);
|
|
25
25
|
}, [isAdvancedExpanded]);
|
|
26
|
-
const timeToExpire = useMemo(() =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [session])
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const ethString = (Number(limit) / Math.pow(10, 18)).toFixed(6);
|
|
33
|
-
return `~${ethString} ETH`;
|
|
34
|
-
}, [session]);
|
|
35
|
-
const sessionString = useMemo(() => JSON.stringify(session, (_, val) => (typeof val === 'bigint' ? val.toString() : val), 2), [session]);
|
|
36
|
-
return (jsxs("div", { className: 'session-permissions-view', children: [jsx("div", { className: 'session-permissions-view__header', children: jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.permissions_label') }) }), jsxs("div", { className: 'session-permissions-view__card', children: [jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsx(Icon, { size: 'small', color: 'text-tertiary', children: jsx(SvgProfileOutline, {}) }), jsx(Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.ownership') })] }), jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsx(Icon, { size: 'small', color: 'text-tertiary', children: jsx(SvgSession, {}) }), jsx(Typography, { variant: 'body_small', children: `${t('dyn_session_permissions.permissions.access')} ${timeToExpire}` })] })] }), jsx("div", { className: 'session-permissions-view__header', children: jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.spending_label') }) }), jsxs("div", { className: 'session-permissions-view__card session-permissions-view__token-card', children: [jsxs("div", { className: 'session-permissions-view__token', children: [jsx(Icon, { size: 'medium', children: jsx(EthereumIcon, {}) }), jsx(Typography, { variant: 'body_normal', children: "ETH" })] }), jsxs("div", { className: 'session-permissions-view__spending', children: [jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.spending_limit') }), jsx(Typography, { variant: 'body_small', children: spendingLimit })] })] }), showAdvanced && (jsxs("div", { className: 'session-permissions-view__panel', children: [jsxs(AccordionToggle, { className: 'session-permissions-view__panel-toggle', isOpen: isAdvancedExpanded, onClick: toggleAdvancedExpanded, labelClassName: 'session-permissions-view__panel-toggle-label', children: [jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.advanced_label') }), jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.advanced_description') })] }), isAdvancedExpanded && (jsx("div", { className: 'session-permissions-view__panel-content', children: jsx(Textarea, { value: sessionString, readOnly: true, rows: 8, id: 'session-permissions-view__raw-json', "data-testid": 'session-permissions-view__raw-json', label: '' }) }))] }))] }));
|
|
26
|
+
const timeToExpire = useMemo(() => getSessionInformationExpiration(session), [session]);
|
|
27
|
+
const spendingLimit = useMemo(() => getSessionInformationSpendingLimit(session), [session]);
|
|
28
|
+
const sessionString = useMemo(() => getSessionInformationJson(session), [session]);
|
|
29
|
+
return (jsxs("div", { className: 'session-permissions-view', children: [jsx("div", { className: 'session-permissions-view__header', children: jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.permissions_label') }) }), jsxs("div", { className: 'session-permissions-view__card', children: [jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsx(Icon, { size: 'small', color: 'text-tertiary', children: jsx(SvgProfileOutline, {}) }), jsx(Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.ownership') })] }), jsxs("div", { className: 'session-permissions-view__card-permission', children: [jsx(Icon, { size: 'small', color: 'text-tertiary', children: jsx(SvgSession, {}) }), jsx(Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions.access', {
|
|
30
|
+
time: timeToExpire,
|
|
31
|
+
}) })] })] }), jsx("div", { className: 'session-permissions-view__header', children: jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.spending_label') }) }), jsxs("div", { className: 'session-permissions-view__card session-permissions-view__token-card', children: [jsxs("div", { className: 'session-permissions-view__token', children: [jsx(Icon, { size: 'medium', children: jsx(EthereumIcon, {}) }), jsx(Typography, { variant: 'body_normal', children: "ETH" })] }), jsxs("div", { className: 'session-permissions-view__spending', children: [jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.spending_limit') }), jsx(Typography, { variant: 'body_small', children: spendingLimit })] })] }), showAdvanced && (jsxs("div", { className: 'session-permissions-view__panel', children: [jsxs(AccordionToggle, { className: 'session-permissions-view__panel-toggle', isOpen: isAdvancedExpanded, onClick: toggleAdvancedExpanded, labelClassName: 'session-permissions-view__panel-toggle-label', children: [jsx(Typography, { variant: 'body_small', weight: 'bold', children: t('dyn_session_permissions.advanced_label') }), jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.advanced_description') })] }), isAdvancedExpanded && (jsx("div", { className: 'session-permissions-view__panel-content', children: jsx(Textarea, { value: sessionString, readOnly: true, rows: 8, id: 'session-permissions-view__raw-json', "data-testid": 'session-permissions-view__raw-json', label: '' }) }))] }))] }));
|
|
37
32
|
};
|
|
38
33
|
|
|
39
34
|
export { SessionPermissionsView };
|
|
@@ -7,9 +7,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
8
|
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
9
9
|
|
|
10
|
-
const EmptySessionsView = () => {
|
|
10
|
+
const EmptySessionsView = ({ loading }) => {
|
|
11
11
|
const { t } = reactI18next.useTranslation();
|
|
12
|
-
return (jsxRuntime.jsx("div", { className: 'empty-sessions-view', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children:
|
|
12
|
+
return (jsxRuntime.jsx("div", { className: 'empty-sessions-view', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: loading
|
|
13
|
+
? t('dyn_session_management.empty_sessions_view.loading')
|
|
14
|
+
: t('dyn_session_management.empty_sessions_view.title') }) }));
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
exports.EmptySessionsView = EmptySessionsView;
|
|
@@ -3,9 +3,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
5
5
|
|
|
6
|
-
const EmptySessionsView = () => {
|
|
6
|
+
const EmptySessionsView = ({ loading }) => {
|
|
7
7
|
const { t } = useTranslation();
|
|
8
|
-
return (jsx("div", { className: 'empty-sessions-view', children: jsx(Typography, { variant: 'body_normal', color: 'secondary', children:
|
|
8
|
+
return (jsx("div", { className: 'empty-sessions-view', children: jsx(Typography, { variant: 'body_normal', color: 'secondary', children: loading
|
|
9
|
+
? t('dyn_session_management.empty_sessions_view.loading')
|
|
10
|
+
: t('dyn_session_management.empty_sessions_view.title') }) }));
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export { EmptySessionsView };
|
|
@@ -5,33 +5,35 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var React = require('react');
|
|
8
9
|
var reactI18next = require('react-i18next');
|
|
9
10
|
var ModalHeader = require('../../../../../components/ModalHeader/ModalHeader.cjs');
|
|
10
11
|
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
11
12
|
var IconButton = require('../../../../../components/IconButton/IconButton.cjs');
|
|
12
13
|
var DynamicWidgetContext = require('../../../context/DynamicWidgetContext.cjs');
|
|
13
|
-
require('react');
|
|
14
14
|
var close = require('../../../../../shared/assets/close.cjs');
|
|
15
15
|
require('@dynamic-labs/iconic');
|
|
16
16
|
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
17
17
|
var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
|
|
18
18
|
var useSessionKeys = require('../../../../../utils/hooks/useSessionKeys/useSessionKeys.cjs');
|
|
19
|
-
var
|
|
19
|
+
var getSessionInformation = require('../../../../../utils/functions/getSessionInformation/getSessionInformation.cjs');
|
|
20
20
|
var SessionPermissionsView = require('../../../../../views/SessionPermissionsView/SessionPermissionsView.cjs');
|
|
21
21
|
|
|
22
22
|
const RevokeAccessView = ({ session }) => {
|
|
23
23
|
const { t } = reactI18next.useTranslation();
|
|
24
24
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
25
25
|
const { revokeSession } = useSessionKeys.useSessionKeys();
|
|
26
|
-
const handleCancel = () => {
|
|
26
|
+
const handleCancel = React.useCallback(() => {
|
|
27
27
|
setDynamicWidgetView('session-management');
|
|
28
|
-
};
|
|
29
|
-
const handleRevoke = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
}, [setDynamicWidgetView]);
|
|
29
|
+
const handleRevoke = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
try {
|
|
31
31
|
yield revokeSession(session.sessionId);
|
|
32
32
|
setDynamicWidgetView('session-management', {
|
|
33
33
|
bannerMessage: {
|
|
34
|
-
message:
|
|
34
|
+
message: t('dyn_session_management.revoke_access_view.success_message', {
|
|
35
|
+
sessionName: getSessionInformation.getSessionInformationName(session),
|
|
36
|
+
}),
|
|
35
37
|
type: 'success',
|
|
36
38
|
},
|
|
37
39
|
});
|
|
@@ -39,12 +41,14 @@ const RevokeAccessView = ({ session }) => {
|
|
|
39
41
|
catch (error) {
|
|
40
42
|
setDynamicWidgetView('session-management', {
|
|
41
43
|
bannerMessage: {
|
|
42
|
-
message:
|
|
44
|
+
message: t('dyn_session_management.revoke_access_view.error_message', {
|
|
45
|
+
sessionName: getSessionInformation.getSessionInformationName(session),
|
|
46
|
+
}),
|
|
43
47
|
type: 'error',
|
|
44
48
|
},
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
|
-
});
|
|
51
|
+
}), [revokeSession, session, setDynamicWidgetView, t]);
|
|
48
52
|
const renderCloseButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleCancel, "aria-label": t('dyn_session_management.aria.close_button_label'), children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
49
53
|
return (jsxRuntime.jsxs("div", { className: 'revoke-access-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: renderCloseButton(), children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.title', children: t('dyn_session_management.revoke_access_view.title') }) }), jsxRuntime.jsxs("div", { className: 'revoke-access-view__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.description', align: 'center', children: t('dyn_session_management.revoke_access_view.description') }), jsxRuntime.jsx(SessionPermissionsView.SessionPermissionsView, { session: session })] }), jsxRuntime.jsxs("div", { className: 'revoke-access-view__footer', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'danger', buttonPadding: 'small', onClick: handleRevoke, dataTestId: 'revoke-access-confirm-button', copykey: 'dyn_session_management.revoke_access_view.revoke_button', expanded: true, children: t('dyn_session_management.revoke_access_view.revoke_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'small', onClick: handleCancel, dataTestId: 'revoke-access-cancel-button', copykey: 'dyn_session_management.revoke_access_view.cancel_button', expanded: true, children: t('dyn_session_management.revoke_access_view.cancel_button') })] })] }));
|
|
50
54
|
};
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useCallback } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
6
|
import { ModalHeader } from '../../../../../components/ModalHeader/ModalHeader.js';
|
|
6
7
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
7
8
|
import { IconButton } from '../../../../../components/IconButton/IconButton.js';
|
|
8
9
|
import { useWidgetContext } from '../../../context/DynamicWidgetContext.js';
|
|
9
|
-
import 'react';
|
|
10
10
|
import { ReactComponent as SvgClose } from '../../../../../shared/assets/close.js';
|
|
11
11
|
import '@dynamic-labs/iconic';
|
|
12
12
|
import '../../../../../context/ViewContext/ViewContext.js';
|
|
13
13
|
import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
|
|
14
14
|
import { useSessionKeys } from '../../../../../utils/hooks/useSessionKeys/useSessionKeys.js';
|
|
15
|
-
import { getSessionInformationName } from '../../../../../utils/functions/
|
|
15
|
+
import { getSessionInformationName } from '../../../../../utils/functions/getSessionInformation/getSessionInformation.js';
|
|
16
16
|
import { SessionPermissionsView } from '../../../../../views/SessionPermissionsView/SessionPermissionsView.js';
|
|
17
17
|
|
|
18
18
|
const RevokeAccessView = ({ session }) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
21
21
|
const { revokeSession } = useSessionKeys();
|
|
22
|
-
const handleCancel = () => {
|
|
22
|
+
const handleCancel = useCallback(() => {
|
|
23
23
|
setDynamicWidgetView('session-management');
|
|
24
|
-
};
|
|
25
|
-
const handleRevoke = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
}, [setDynamicWidgetView]);
|
|
25
|
+
const handleRevoke = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
try {
|
|
27
27
|
yield revokeSession(session.sessionId);
|
|
28
28
|
setDynamicWidgetView('session-management', {
|
|
29
29
|
bannerMessage: {
|
|
30
|
-
message:
|
|
30
|
+
message: t('dyn_session_management.revoke_access_view.success_message', {
|
|
31
|
+
sessionName: getSessionInformationName(session),
|
|
32
|
+
}),
|
|
31
33
|
type: 'success',
|
|
32
34
|
},
|
|
33
35
|
});
|
|
@@ -35,12 +37,14 @@ const RevokeAccessView = ({ session }) => {
|
|
|
35
37
|
catch (error) {
|
|
36
38
|
setDynamicWidgetView('session-management', {
|
|
37
39
|
bannerMessage: {
|
|
38
|
-
message:
|
|
40
|
+
message: t('dyn_session_management.revoke_access_view.error_message', {
|
|
41
|
+
sessionName: getSessionInformationName(session),
|
|
42
|
+
}),
|
|
39
43
|
type: 'error',
|
|
40
44
|
},
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
});
|
|
47
|
+
}), [revokeSession, session, setDynamicWidgetView, t]);
|
|
44
48
|
const renderCloseButton = () => (jsx(IconButton, { onClick: handleCancel, "aria-label": t('dyn_session_management.aria.close_button_label'), children: jsx(SvgClose, {}) }));
|
|
45
49
|
return (jsxs("div", { className: 'revoke-access-view', children: [jsx(ModalHeader, { trailing: renderCloseButton(), children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.title', children: t('dyn_session_management.revoke_access_view.title') }) }), jsxs("div", { className: 'revoke-access-view__body', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.description', align: 'center', children: t('dyn_session_management.revoke_access_view.description') }), jsx(SessionPermissionsView, { session: session })] }), jsxs("div", { className: 'revoke-access-view__footer', children: [jsx(TypographyButton, { buttonVariant: 'danger', buttonPadding: 'small', onClick: handleRevoke, dataTestId: 'revoke-access-confirm-button', copykey: 'dyn_session_management.revoke_access_view.revoke_button', expanded: true, children: t('dyn_session_management.revoke_access_view.revoke_button') }), jsx(TypographyButton, { buttonPadding: 'small', onClick: handleCancel, dataTestId: 'revoke-access-cancel-button', copykey: 'dyn_session_management.revoke_access_view.cancel_button', expanded: true, children: t('dyn_session_management.revoke_access_view.cancel_button') })] })] }));
|
|
46
50
|
};
|
|
@@ -8,11 +8,96 @@ var React = require('react');
|
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
10
10
|
var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
|
|
11
|
-
var
|
|
12
|
-
|
|
11
|
+
var getSessionInformation = require('../../../../../utils/functions/getSessionInformation/getSessionInformation.cjs');
|
|
12
|
+
require('@dynamic-labs/utils');
|
|
13
|
+
require('../../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
14
|
+
var AccordionToggle = require('../../../../../components/Accordion/components/AccordionToggle/AccordionToggle.cjs');
|
|
15
|
+
require('../../../../../components/Alert/Alert.cjs');
|
|
16
|
+
require('../../../../../events/dynamicEvents.cjs');
|
|
17
|
+
require('../../../../../../../_virtual/_tslib.cjs');
|
|
18
|
+
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
19
|
+
require('../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
20
|
+
require('@dynamic-labs/sdk-api-core');
|
|
21
|
+
require('../../../../../shared/logger.cjs');
|
|
13
22
|
require('@dynamic-labs/iconic');
|
|
23
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
24
|
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
-
|
|
25
|
+
require('@dynamic-labs/wallet-book');
|
|
26
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
27
|
+
require('../../../../../utils/constants/values.cjs');
|
|
28
|
+
require('../../../../../shared/consts/index.cjs');
|
|
29
|
+
require('../../../../../store/state/authMode/authMode.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('../../../../../store/state/nonce/nonce.cjs');
|
|
35
|
+
require('../../../../../store/state/projectSettings/projectSettings.cjs');
|
|
36
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
37
|
+
require('../../../../../store/state/user/user.cjs');
|
|
38
|
+
require('../../../../../locale/locale.cjs');
|
|
39
|
+
require('../../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
40
|
+
require('../../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
41
|
+
require('../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
42
|
+
require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
43
|
+
require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
44
|
+
require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
45
|
+
require('../../../../../context/VerificationContext/VerificationContext.cjs');
|
|
46
|
+
require('react-dom');
|
|
47
|
+
require('../../../../../utils/functions/compareChains/compareChains.cjs');
|
|
48
|
+
require('../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
49
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
50
|
+
require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
51
|
+
require('bs58');
|
|
52
|
+
require('@dynamic-labs/types');
|
|
53
|
+
require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
54
|
+
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
55
|
+
require('../../../../../context/WalletContext/WalletContext.cjs');
|
|
56
|
+
require('../../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
57
|
+
require('yup');
|
|
58
|
+
require('../../../../../context/MockContext/MockContext.cjs');
|
|
59
|
+
require('../../../../../views/CollectUserDataView/useFields.cjs');
|
|
60
|
+
require('../../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
61
|
+
require('../../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
62
|
+
require('@dynamic-labs/rpc-providers');
|
|
63
|
+
require('../../../../../store/state/walletOptions/walletOptions.cjs');
|
|
64
|
+
require('../../../../../context/FooterAnimationContext/index.cjs');
|
|
65
|
+
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
66
|
+
require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
67
|
+
require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
68
|
+
require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
69
|
+
require('../../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
70
|
+
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
71
|
+
require('../../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
72
|
+
require('react-focus-lock');
|
|
73
|
+
require('../../../context/DynamicWidgetContext.cjs');
|
|
74
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
75
|
+
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
76
|
+
require('formik');
|
|
77
|
+
require('../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
78
|
+
require('../../../../../store/state/sendBalances.cjs');
|
|
79
|
+
require('../../../../../components/Input/Input.cjs');
|
|
80
|
+
require('../../../../../components/OverlayCard/OverlayCard.cjs');
|
|
81
|
+
require('../../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
82
|
+
require('../../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
83
|
+
require('../../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
84
|
+
require('../../../../../context/OnrampContext/OnrampContext.cjs');
|
|
85
|
+
require('qrcode');
|
|
86
|
+
require('../../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
87
|
+
require('../../../../../../index.cjs');
|
|
88
|
+
require('../../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
89
|
+
require('../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
90
|
+
require('../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
91
|
+
require('@hcaptcha/react-hcaptcha');
|
|
92
|
+
require('../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
93
|
+
require('../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
94
|
+
require('../../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
95
|
+
require('../../../../../store/state/tokenBalances.cjs');
|
|
96
|
+
require('../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
97
|
+
require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
98
|
+
require('../../../../../components/IsBrowser/IsBrowser.cjs');
|
|
99
|
+
require('../../../../../components/Popper/Popper/Popper.cjs');
|
|
100
|
+
require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
16
101
|
|
|
17
102
|
const SessionListItem = ({ session, onRevokeAccessClick, }) => {
|
|
18
103
|
const { t } = reactI18next.useTranslation();
|
|
@@ -23,9 +108,15 @@ const SessionListItem = ({ session, onRevokeAccessClick, }) => {
|
|
|
23
108
|
const toggleExpanded = React.useCallback(() => {
|
|
24
109
|
setIsExpanded((prev) => !prev);
|
|
25
110
|
}, []);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
111
|
+
const sessionName = getSessionInformation.getSessionInformationName(session);
|
|
112
|
+
const spendingLimit = getSessionInformation.getSessionInformationSpendingLimit(session);
|
|
113
|
+
const timeToExpiration = getSessionInformation.getSessionInformationExpiration(session);
|
|
114
|
+
const timeSinceCreation = getSessionInformation.getSessionInformationTimeSinceCreation(session);
|
|
115
|
+
return (jsxRuntime.jsxs("div", { className: 'session-management-session', children: [jsxRuntime.jsxs("div", { className: 'session-management-session__main', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', children: getSessionInformation.getSessionInformationName(session) }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleRevokeAccess, children: t('dyn_session_management.session_component.revoke_button') })] }), jsxRuntime.jsxs("div", { className: 'session-management-session__permissions-accordion', children: [jsxRuntime.jsx(AccordionToggle.AccordionToggle, { isOpen: isExpanded, onClick: toggleExpanded, className: 'session-management-session__permissions-toggle', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_management.session_component.permission_details') }) }), isExpanded && (jsxRuntime.jsxs("div", { className: 'session-management-session__permissions', children: [jsxRuntime.jsx("div", { className: 'session-management-session__permissions-header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: sessionName }) }), jsxRuntime.jsx("div", { className: 'session-management-session__permissions-body', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.connected', {
|
|
116
|
+
time: timeSinceCreation,
|
|
117
|
+
}) }) }), jsxRuntime.jsx("div", { className: 'session-management-session__permissions-header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions_label') }) }), jsxRuntime.jsx("div", { className: 'session-management-session__permissions-body', children: jsxRuntime.jsxs("ul", { className: 'session-management-session__permissions-list', children: [jsxRuntime.jsx("li", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.permissions.ownership') }) }), jsxRuntime.jsx("li", { children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.permissions.access', {
|
|
118
|
+
time: timeToExpiration,
|
|
119
|
+
}) }) })] }) }), jsxRuntime.jsx("div", { className: 'session-management-session__permissions-header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_permissions.spending_label') }) }), jsxRuntime.jsx("div", { className: 'session-management-session__permissions-body', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: spendingLimit }) })] }))] })] }));
|
|
29
120
|
};
|
|
30
121
|
|
|
31
122
|
exports.SessionListItem = SessionListItem;
|
package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js
CHANGED
|
@@ -4,11 +4,96 @@ import { useState, useCallback } from 'react';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
6
6
|
import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { getSessionInformationName, getSessionInformationSpendingLimit, getSessionInformationExpiration, getSessionInformationTimeSinceCreation } from '../../../../../utils/functions/getSessionInformation/getSessionInformation.js';
|
|
8
|
+
import '@dynamic-labs/utils';
|
|
9
|
+
import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
10
|
+
import { AccordionToggle } from '../../../../../components/Accordion/components/AccordionToggle/AccordionToggle.js';
|
|
11
|
+
import '../../../../../components/Alert/Alert.js';
|
|
12
|
+
import '../../../../../events/dynamicEvents.js';
|
|
13
|
+
import '../../../../../../../_virtual/_tslib.js';
|
|
14
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
15
|
+
import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
16
|
+
import '@dynamic-labs/sdk-api-core';
|
|
17
|
+
import '../../../../../shared/logger.js';
|
|
9
18
|
import '@dynamic-labs/iconic';
|
|
19
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
20
|
import '../../../../../context/ViewContext/ViewContext.js';
|
|
11
|
-
import
|
|
21
|
+
import '@dynamic-labs/wallet-book';
|
|
22
|
+
import '../../../../../utils/constants/colors.js';
|
|
23
|
+
import '../../../../../utils/constants/values.js';
|
|
24
|
+
import '../../../../../shared/consts/index.js';
|
|
25
|
+
import '../../../../../store/state/authMode/authMode.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 '../../../../../store/state/nonce/nonce.js';
|
|
31
|
+
import '../../../../../store/state/projectSettings/projectSettings.js';
|
|
32
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
33
|
+
import '../../../../../store/state/user/user.js';
|
|
34
|
+
import '../../../../../locale/locale.js';
|
|
35
|
+
import '../../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
36
|
+
import '../../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
37
|
+
import '../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
38
|
+
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
39
|
+
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
|
+
import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
41
|
+
import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
42
|
+
import 'react-dom';
|
|
43
|
+
import '../../../../../utils/functions/compareChains/compareChains.js';
|
|
44
|
+
import '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
45
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
46
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
47
|
+
import 'bs58';
|
|
48
|
+
import '@dynamic-labs/types';
|
|
49
|
+
import '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
50
|
+
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
51
|
+
import '../../../../../context/WalletContext/WalletContext.js';
|
|
52
|
+
import '../../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
53
|
+
import 'yup';
|
|
54
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
55
|
+
import '../../../../../views/CollectUserDataView/useFields.js';
|
|
56
|
+
import '../../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
57
|
+
import '../../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
58
|
+
import '@dynamic-labs/rpc-providers';
|
|
59
|
+
import '../../../../../store/state/walletOptions/walletOptions.js';
|
|
60
|
+
import '../../../../../context/FooterAnimationContext/index.js';
|
|
61
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
62
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
63
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
64
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
65
|
+
import '../../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
66
|
+
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
67
|
+
import '../../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
68
|
+
import 'react-focus-lock';
|
|
69
|
+
import '../../../context/DynamicWidgetContext.js';
|
|
70
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
71
|
+
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
72
|
+
import 'formik';
|
|
73
|
+
import '../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
74
|
+
import '../../../../../store/state/sendBalances.js';
|
|
75
|
+
import '../../../../../components/Input/Input.js';
|
|
76
|
+
import '../../../../../components/OverlayCard/OverlayCard.js';
|
|
77
|
+
import '../../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
78
|
+
import '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
79
|
+
import '../../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
80
|
+
import '../../../../../context/OnrampContext/OnrampContext.js';
|
|
81
|
+
import 'qrcode';
|
|
82
|
+
import '../../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
83
|
+
import '../../../../../../index.js';
|
|
84
|
+
import '../../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
85
|
+
import '../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
86
|
+
import '../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
87
|
+
import '@hcaptcha/react-hcaptcha';
|
|
88
|
+
import '../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
89
|
+
import '../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
90
|
+
import '../../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
91
|
+
import '../../../../../store/state/tokenBalances.js';
|
|
92
|
+
import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
93
|
+
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
94
|
+
import '../../../../../components/IsBrowser/IsBrowser.js';
|
|
95
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
96
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
12
97
|
|
|
13
98
|
const SessionListItem = ({ session, onRevokeAccessClick, }) => {
|
|
14
99
|
const { t } = useTranslation();
|
|
@@ -19,9 +104,15 @@ const SessionListItem = ({ session, onRevokeAccessClick, }) => {
|
|
|
19
104
|
const toggleExpanded = useCallback(() => {
|
|
20
105
|
setIsExpanded((prev) => !prev);
|
|
21
106
|
}, []);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
107
|
+
const sessionName = getSessionInformationName(session);
|
|
108
|
+
const spendingLimit = getSessionInformationSpendingLimit(session);
|
|
109
|
+
const timeToExpiration = getSessionInformationExpiration(session);
|
|
110
|
+
const timeSinceCreation = getSessionInformationTimeSinceCreation(session);
|
|
111
|
+
return (jsxs("div", { className: 'session-management-session', children: [jsxs("div", { className: 'session-management-session__main', children: [jsx(Typography, { variant: 'body_normal', children: getSessionInformationName(session) }), jsx(TypographyButton, { onClick: handleRevokeAccess, children: t('dyn_session_management.session_component.revoke_button') })] }), jsxs("div", { className: 'session-management-session__permissions-accordion', children: [jsx(AccordionToggle, { isOpen: isExpanded, onClick: toggleExpanded, className: 'session-management-session__permissions-toggle', children: jsx(Typography, { variant: 'body_small', children: t('dyn_session_management.session_component.permission_details') }) }), isExpanded && (jsxs("div", { className: 'session-management-session__permissions', children: [jsx("div", { className: 'session-management-session__permissions-header', children: jsx(Typography, { variant: 'body_small', children: sessionName }) }), jsx("div", { className: 'session-management-session__permissions-body', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.connected', {
|
|
112
|
+
time: timeSinceCreation,
|
|
113
|
+
}) }) }), jsx("div", { className: 'session-management-session__permissions-header', children: jsx(Typography, { variant: 'body_small', children: t('dyn_session_permissions.permissions_label') }) }), jsx("div", { className: 'session-management-session__permissions-body', children: jsxs("ul", { className: 'session-management-session__permissions-list', children: [jsx("li", { children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.permissions.ownership') }) }), jsx("li", { children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: t('dyn_session_permissions.permissions.access', {
|
|
114
|
+
time: timeToExpiration,
|
|
115
|
+
}) }) })] }) }), jsx("div", { className: 'session-management-session__permissions-header', children: jsx(Typography, { variant: 'body_small', children: t('dyn_session_permissions.spending_label') }) }), jsx("div", { className: 'session-management-session__permissions-body', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: spendingLimit }) })] }))] })] }));
|
|
25
116
|
};
|
|
26
117
|
|
|
27
118
|
export { SessionListItem };
|