@abtnode/ux 1.17.8-beta-20260108-021819-e099f0ca → 1.17.8-beta-20260108-120904-21cb5fb6

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.
@@ -2,12 +2,14 @@
2
2
  import { useContext, useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Skeleton, Box, Typography, Tooltip, keyframes } from '@mui/material';
5
+ import { useCreation } from 'ahooks';
5
6
  import { Icon } from '@iconify/react';
6
7
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
8
+ // eslint-disable-next-line import/no-unresolved
9
+ import { formatNumber } from '@blocklet/aigne-hub/utils/util';
7
10
  import CachedIcon from '@mui/icons-material/Cached';
8
11
  import { withQuery } from 'ufo';
9
12
  import { CardWrapper, ButtonWrapper } from './basic';
10
- import { formatAmount } from '../utils';
11
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
14
  export default function CreditCard({
13
15
  loading = false,
@@ -35,14 +37,20 @@ export default function CreditCard({
35
37
  const isDeficit = useMemo(() => {
36
38
  return Number(credit?.creditBalance?.balance) <= 0 && Number(credit?.creditBalance?.pendingCredit) > 0;
37
39
  }, [credit]);
38
- if (!credit && !loading) {
39
- return null;
40
- }
41
40
  const {
42
41
  creditBalance,
43
42
  profileLink = '',
44
- paymentLink = ''
43
+ paymentLink = '',
44
+ creditPrefix = ''
45
45
  } = credit || {};
46
+ const creditValue = useCreation(() => {
47
+ const formattedBalance = formatNumber(creditBalance?.balance ?? 0);
48
+ const displayValue = creditPrefix ? `${creditPrefix} ${formattedBalance}` : formattedBalance;
49
+ return isDeficit ? `- ${displayValue}` : displayValue;
50
+ }, [isDeficit, creditPrefix, creditBalance?.balance]);
51
+ if (!credit && !loading) {
52
+ return null;
53
+ }
46
54
  return /*#__PURE__*/_jsx(CardWrapper, {
47
55
  children: loading ? /*#__PURE__*/_jsxs(Box, {
48
56
  sx: {
@@ -117,9 +125,7 @@ export default function CreditCard({
117
125
  sx: {
118
126
  color: !isSelfHost && isDeficit ? 'error.main' : 'text.primary'
119
127
  },
120
- children: [/*#__PURE__*/_jsx("span", {
121
- children: isSelfHost ? t('setting.aigne.infinite') : isDeficit ? `- ${formatAmount(creditBalance?.pendingCredit)}` : formatAmount(creditBalance.balance)
122
- }), !isSelfHost ? /*#__PURE__*/_jsx(Tooltip, {
128
+ children: [isSelfHost ? t('setting.aigne.infinite') : creditValue, !isSelfHost ? /*#__PURE__*/_jsx(Tooltip, {
123
129
  title: t('common.refresh'),
124
130
  children: /*#__PURE__*/_jsx(CachedIcon, {
125
131
  sx: {
@@ -1,11 +1,11 @@
1
1
  import { useImperativeHandle } from 'react';
2
2
  import { Box, Button } from '@mui/material';
3
3
  import noop from 'lodash/noop';
4
- import { useMemoizedFn } from 'ahooks';
4
+ import { useMemoizedFn, useCreation } from 'ahooks';
5
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
6
  import Toast from '@arcblock/ux/lib/Toast';
7
7
  import { Link } from 'react-router-dom';
8
- import { joinURL } from 'ufo';
8
+ import { joinURL, withQuery } from 'ufo';
9
9
  import { WELLKNOWN_BLOCKLET_ADMIN_PATH } from '@abtnode/constant';
10
10
  import PropTypes from 'prop-types';
11
11
  import { useNodeContext } from '../../../contexts/node';
@@ -17,7 +17,8 @@ function LoginProviderEmail({
17
17
  sortMaps = {}
18
18
  }) {
19
19
  const {
20
- api
20
+ api,
21
+ inService
21
22
  } = useNodeContext();
22
23
  const {
23
24
  blocklet
@@ -47,13 +48,24 @@ function LoginProviderEmail({
47
48
  Toast.error(err.message || t('common.saveFailed'));
48
49
  }
49
50
  });
51
+ const emailSettingUrl = useCreation(() => {
52
+ if (inService) {
53
+ return withQuery(joinURL(WELLKNOWN_BLOCKLET_ADMIN_PATH, '/notification/settings'), {
54
+ type: 'email'
55
+ });
56
+ }
57
+ return withQuery(joinURL('/blocklets', blocklet.appPid, '/configuration'), {
58
+ tab: 'notification',
59
+ type: 'email'
60
+ });
61
+ }, [inService, blocklet.appPid]);
50
62
  useImperativeHandle(ref, () => ({
51
63
  submit: onSubmit
52
64
  }), [onSubmit]);
53
65
  return /*#__PURE__*/_jsxs(Box, {
54
66
  children: [t('authentication.emailLoginDescription'), /*#__PURE__*/_jsx("br", {}), t('authentication.emailNotificationRequired'), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx(Box, {
55
67
  component: Link,
56
- to: joinURL(WELLKNOWN_BLOCKLET_ADMIN_PATH, '/notification/settings'),
68
+ to: emailSettingUrl,
57
69
  sx: {
58
70
  mt: 1,
59
71
  display: 'inline-block'
@@ -220,7 +220,7 @@ export default function LoginProviders() {
220
220
  }
221
221
  });
222
222
  delete sortMaps[name];
223
- Toast.success(t('common.deleteSuccess'));
223
+ Toast.success(t('common.removeSuccess'));
224
224
  close();
225
225
  } catch (err) {
226
226
  Toast.error(err.message || t('common.deleteFailed'));
@@ -1,8 +1,9 @@
1
1
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Tabs from '@arcblock/ux/lib/Tabs';
3
3
  import { Box, Typography } from '@mui/material';
4
- import { useCreation } from 'ahooks';
5
- import { useContext, useMemo, useState } from 'react';
4
+ import { useSearchParams } from 'react-router-dom';
5
+ import { useCreation, useMemoizedFn } from 'ahooks';
6
+ import { useContext, useMemo } from 'react';
6
7
  import NotificationEmail from './email';
7
8
  import NotificationPushKit from './push-kit';
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -43,11 +44,14 @@ const tabs = [{
43
44
  }),
44
45
  value: 'webhooks'
45
46
  }];
47
+ const validTabs = tabs.map(t => t.value);
46
48
  function BlockletNotification() {
47
- const [currentTab, setCurrentTab] = useState(tabs[0].value);
48
49
  const {
49
50
  t
50
51
  } = useContext(LocaleContext);
52
+ const [params, setParams] = useSearchParams();
53
+ const typeParam = params.get('type');
54
+ const currentTab = validTabs.includes(typeParam) ? typeParam : tabs[0].value;
51
55
  const contents = useCreation(() => ({
52
56
  email: /*#__PURE__*/_jsx(NotificationEmail, {}),
53
57
  pushKit: /*#__PURE__*/_jsx(NotificationPushKit, {}),
@@ -60,6 +64,12 @@ function BlockletNotification() {
60
64
  children: t('notification.webhooks.description')
61
65
  })
62
66
  }), [t]);
67
+ const onTablChange = useMemoizedFn(tab => {
68
+ params.set('type', tab);
69
+ setParams(params, {
70
+ replace: true
71
+ });
72
+ });
63
73
  const tabBodyStyle = useMemo(() => {
64
74
  return {
65
75
  padding: '10px 0'
@@ -70,7 +80,7 @@ function BlockletNotification() {
70
80
  variant: "card",
71
81
  tabs: tabs,
72
82
  current: currentTab,
73
- onChange: setCurrentTab
83
+ onChange: onTablChange
74
84
  }), /*#__PURE__*/_jsx(Box, {
75
85
  style: tabBodyStyle,
76
86
  children: contents[currentTab]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.17.8-beta-20260108-021819-e099f0ca",
3
+ "version": "1.17.8-beta-20260108-120904-21cb5fb6",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,10 +23,10 @@
23
23
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@abtnode/auth": "1.17.8-beta-20260108-021819-e099f0ca",
27
- "@abtnode/constant": "1.17.8-beta-20260108-021819-e099f0ca",
28
- "@abtnode/docker-utils": "1.17.8-beta-20260108-021819-e099f0ca",
29
- "@abtnode/util": "1.17.8-beta-20260108-021819-e099f0ca",
26
+ "@abtnode/auth": "1.17.8-beta-20260108-120904-21cb5fb6",
27
+ "@abtnode/constant": "1.17.8-beta-20260108-120904-21cb5fb6",
28
+ "@abtnode/docker-utils": "1.17.8-beta-20260108-120904-21cb5fb6",
29
+ "@abtnode/util": "1.17.8-beta-20260108-120904-21cb5fb6",
30
30
  "@ahooksjs/use-url-state": "^3.5.1",
31
31
  "@arcblock/did": "^1.28.4",
32
32
  "@arcblock/did-connect-react": "^3.4.5",
@@ -38,15 +38,15 @@
38
38
  "@arcblock/terminal": "^3.4.5",
39
39
  "@arcblock/ux": "^3.4.5",
40
40
  "@arcblock/validator": "^1.28.4",
41
- "@blocklet/aigne-hub": "^0.7.15",
42
- "@blocklet/constant": "1.17.8-beta-20260108-021819-e099f0ca",
41
+ "@blocklet/aigne-hub": "^0.7.16",
42
+ "@blocklet/constant": "1.17.8-beta-20260108-120904-21cb5fb6",
43
43
  "@blocklet/did-domain-react": "^0.6.17",
44
44
  "@blocklet/did-space-react": "^1.2.14",
45
45
  "@blocklet/error": "^0.3.5",
46
- "@blocklet/js-sdk": "1.17.8-beta-20260108-021819-e099f0ca",
46
+ "@blocklet/js-sdk": "1.17.8-beta-20260108-120904-21cb5fb6",
47
47
  "@blocklet/launcher-layout": "^3.4.5",
48
48
  "@blocklet/list": "^0.18.11",
49
- "@blocklet/meta": "1.17.8-beta-20260108-021819-e099f0ca",
49
+ "@blocklet/meta": "1.17.8-beta-20260108-120904-21cb5fb6",
50
50
  "@blocklet/theme": "^3.4.5",
51
51
  "@blocklet/ui-react": "^3.4.5",
52
52
  "@blocklet/uploader": "^0.3.19",
@@ -127,5 +127,5 @@
127
127
  "babel-plugin-inline-react-svg": "^2.0.2",
128
128
  "glob": "^10.4.1"
129
129
  },
130
- "gitHead": "88c2e45e1c1d2d636bb240bf4d9c05dbabe7b5a8"
130
+ "gitHead": "81be4cd432cd3803b72514917e6197c31e916b9d"
131
131
  }