@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.
Files changed (35) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -1
  6. package/src/lib/context/DynamicContext/DynamicContext.js +3 -1
  7. package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +6 -0
  8. package/src/lib/locale/en/translation.cjs +10 -2
  9. package/src/lib/locale/en/translation.d.ts +9 -1
  10. package/src/lib/locale/en/translation.js +10 -2
  11. package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.cjs +1 -0
  12. package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.d.ts +1 -0
  13. package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.js +1 -0
  14. package/src/lib/store/utils/settingsUtils/settingsUtils.d.ts +1 -1
  15. package/src/lib/styles/index.shadow.cjs +1 -1
  16. package/src/lib/styles/index.shadow.js +1 -1
  17. package/src/lib/utils/functions/getSessionInformation/getSessionInformation.cjs +34 -0
  18. package/src/lib/utils/functions/getSessionInformation/getSessionInformation.d.ts +11 -0
  19. package/src/lib/utils/functions/getSessionInformation/getSessionInformation.js +26 -0
  20. package/src/lib/utils/functions/getSessionInformation/index.d.ts +1 -0
  21. package/src/lib/views/SessionPermissionsView/SessionPermissionsView.cjs +7 -12
  22. package/src/lib/views/SessionPermissionsView/SessionPermissionsView.js +7 -12
  23. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.cjs +4 -2
  24. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.d.ts +4 -1
  25. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.js +4 -2
  26. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +12 -8
  27. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +12 -8
  28. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.cjs +97 -6
  29. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js +97 -6
  30. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +6 -2
  31. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +6 -2
  32. package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.cjs +0 -10
  33. package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.d.ts +0 -2
  34. package/src/lib/utils/functions/getSessionInformationName/getSessionInformationName.js +0 -6
  35. package/src/lib/utils/functions/getSessionInformationName/index.d.ts +0 -1
@@ -24,8 +24,12 @@ const SessionManagementView = ({ bannerMessage, }) => {
24
24
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
25
25
  const { listSessions } = useSessionKeys.useSessionKeys();
26
26
  const [sessions, setSessions] = React.useState([]);
27
+ const [loading, setLoading] = React.useState(false);
27
28
  React.useEffect(() => {
28
- listSessions().then(setSessions);
29
+ setLoading(true);
30
+ listSessions()
31
+ .then(setSessions)
32
+ .finally(() => setLoading(false));
29
33
  }, [listSessions]);
30
34
  const handleBackButtonClick = React.useCallback(() => {
31
35
  setDynamicWidgetView('account-and-security-settings');
@@ -40,7 +44,7 @@ const SessionManagementView = ({ bannerMessage, }) => {
40
44
  }, [setDynamicWidgetView]);
41
45
  const renderBackButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
42
46
  const renderInfoButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }));
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))) })) })] }));
47
+ 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, { loading: loading })) : (jsxRuntime.jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsxRuntime.jsx(SessionListItem.SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
44
48
  };
45
49
 
46
50
  exports.SessionManagementView = SessionManagementView;
@@ -20,8 +20,12 @@ const SessionManagementView = ({ bannerMessage, }) => {
20
20
  const { setDynamicWidgetView } = useWidgetContext();
21
21
  const { listSessions } = useSessionKeys();
22
22
  const [sessions, setSessions] = useState([]);
23
+ const [loading, setLoading] = useState(false);
23
24
  useEffect(() => {
24
- listSessions().then(setSessions);
25
+ setLoading(true);
26
+ listSessions()
27
+ .then(setSessions)
28
+ .finally(() => setLoading(false));
25
29
  }, [listSessions]);
26
30
  const handleBackButtonClick = useCallback(() => {
27
31
  setDynamicWidgetView('account-and-security-settings');
@@ -36,7 +40,7 @@ const SessionManagementView = ({ bannerMessage, }) => {
36
40
  }, [setDynamicWidgetView]);
37
41
  const renderBackButton = () => (jsx(IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsx(SvgChevronLeft, {}) }));
38
42
  const renderInfoButton = () => (jsx(IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsx(SvgFooterInfoIcon, {}) }));
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))) })) })] }));
43
+ 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, { loading: loading })) : (jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsx(SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
40
44
  };
41
45
 
42
46
  export { SessionManagementView };
@@ -1,10 +0,0 @@
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
-
8
- const getSessionInformationName = (session) => { var _a; return (_a = session.origin) !== null && _a !== void 0 ? _a : shortenWalletAddress.shortenWalletAddress(session.sessionId); };
9
-
10
- exports.getSessionInformationName = getSessionInformationName;
@@ -1,2 +0,0 @@
1
- import { SessionInformation } from '../../types/SessionInformation';
2
- export declare const getSessionInformationName: (session: SessionInformation) => string;
@@ -1,6 +0,0 @@
1
- 'use client'
2
- import { shortenWalletAddress } from '../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
3
-
4
- const getSessionInformationName = (session) => { var _a; return (_a = session.origin) !== null && _a !== void 0 ? _a : shortenWalletAddress(session.sessionId); };
5
-
6
- export { getSessionInformationName };
@@ -1 +0,0 @@
1
- export * from './getSessionInformationName';