@blocklet/aigne-hub 0.3.9 → 0.3.11

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.
@@ -52,6 +52,7 @@ async function callRemoteApi(input, config, options = {}) {
52
52
  const url = await getCachedUrl(baseUrl);
53
53
  const headers = {
54
54
  Authorization: `Bearer ${accessKey}`,
55
+ 'x-aigne-hub-client-did': process.env.BLOCKLET_APP_PID || '',
55
56
  ...config.additionalHeaders,
56
57
  };
57
58
  if (config.isStreamEndpoint) {
@@ -58,13 +58,13 @@ const Wrapped = (0, system_1.styled)(Datatable_1.default) `
58
58
  }
59
59
  table.MuiTable-root {
60
60
  outline: 1px solid;
61
- outline-color: ${({ theme }) => theme.palette.grey[100]};
61
+ outline-color: ${({ theme }) => theme.palette.divider};
62
62
  border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
63
63
  overflow: hidden;
64
64
  }
65
65
  [class*='MUIDataTable-responsiveBase'] {
66
66
  outline: 1px solid;
67
- outline-color: ${({ theme }) => theme.palette.grey[100]};
67
+ outline-color: ${({ theme }) => theme.palette.divider};
68
68
  border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
69
69
  }
70
70
 
@@ -27,7 +27,10 @@ function UserCreditCard({ baseUrl, apiKey, onSuccess = () => { }, onError = () =
27
27
  },
28
28
  });
29
29
  if (loading) {
30
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { p: 2, textAlign: 'center' }, children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: t('loadingUserInfo') })] }));
30
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { p: 2, textAlign: 'center' }, children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
31
+ color: 'text.secondary',
32
+ mt: 1,
33
+ }, children: t('loadingUserInfo') })] }));
31
34
  }
32
35
  if (!userInfoData) {
33
36
  return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { p: 2 }, children: (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "info", sx: { fontSize: '0.875rem' }, children: t('noUserData') }) }));
@@ -35,13 +38,33 @@ function UserCreditCard({ baseUrl, apiKey, onSuccess = () => { }, onError = () =
35
38
  if (mode === 'custom') {
36
39
  return render(userInfoData);
37
40
  }
38
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { sx: { p: 2, border: '1px solid', borderColor: 'divider', borderRadius: 2, width: '100%' }, spacing: 2, className: "user-credit-card", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", children: t('username') }), (0, jsx_runtime_1.jsx)(UserCard_1.default, { user: userInfoData.user, showHoverCard: true, popupShowDid: true, sx: {
41
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { sx: { p: 2, border: '1px solid', borderColor: 'divider', borderRadius: 2, width: '100%' }, spacing: 2, className: "user-credit-card", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", sx: {
42
+ justifyContent: 'space-between',
43
+ alignItems: 'center',
44
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
45
+ color: 'text.secondary',
46
+ }, children: t('username') }), (0, jsx_runtime_1.jsx)(UserCard_1.default, { user: userInfoData.user, showHoverCard: true, popupShowDid: true, sx: {
39
47
  border: 'none',
40
48
  p: 0,
41
49
  minWidth: 0,
42
50
  }, avatarProps: {
43
51
  size: 24,
44
- } })] }), (userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.enableCredit) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", children: t('creditBalance') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", fontWeight: "bold", children: (0, util_1.formatNumber)(((_a = userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.creditBalance) === null || _a === void 0 ? void 0 : _a.balance) || '0') })] }), ((_b = userInfoData.creditBalance) === null || _b === void 0 ? void 0 : _b.pendingCredit) && Number(userInfoData.creditBalance.pendingCredit) > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", children: t('pendingCredit') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", fontWeight: "bold", sx: { color: 'error.main' }, children: (0, util_1.formatNumber)(userInfoData.creditBalance.pendingCredit) })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1.5, sx: { mt: 1 }, className: "user-credit-card-actions", children: [(userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) && ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", className: "recharge-button", onClick: () => {
52
+ } })] }), (userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.enableCredit) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", sx: {
53
+ justifyContent: 'space-between',
54
+ alignItems: 'center',
55
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
56
+ color: 'text.secondary',
57
+ }, children: t('creditBalance') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", sx: {
58
+ fontWeight: 'bold',
59
+ }, children: (0, util_1.formatNumber)(((_a = userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.creditBalance) === null || _a === void 0 ? void 0 : _a.balance) || '0') })] }), ((_b = userInfoData.creditBalance) === null || _b === void 0 ? void 0 : _b.pendingCredit) && Number(userInfoData.creditBalance.pendingCredit) > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", sx: {
60
+ justifyContent: 'space-between',
61
+ alignItems: 'center',
62
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: {
63
+ color: 'text.secondary',
64
+ }, children: t('pendingCredit') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", sx: {
65
+ fontWeight: 'bold',
66
+ color: 'error.main',
67
+ }, children: (0, util_1.formatNumber)(userInfoData.creditBalance.pendingCredit) })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1.5, sx: { mt: 1 }, className: "user-credit-card-actions", children: [(userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) && ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", className: "recharge-button", onClick: () => {
45
68
  window.open((userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) || '', '_blank');
46
69
  }, sx: {
47
70
  flex: 1,
@@ -42,6 +42,7 @@ export async function callRemoteApi(input, config, options = {}) {
42
42
  const url = await getCachedUrl(baseUrl);
43
43
  const headers = {
44
44
  Authorization: `Bearer ${accessKey}`,
45
+ 'x-aigne-hub-client-did': process.env.BLOCKLET_APP_PID || '',
45
46
  ...config.additionalHeaders,
46
47
  };
47
48
  if (config.isStreamEndpoint) {
@@ -53,13 +53,13 @@ const Wrapped = styled(Datatable) `
53
53
  }
54
54
  table.MuiTable-root {
55
55
  outline: 1px solid;
56
- outline-color: ${({ theme }) => theme.palette.grey[100]};
56
+ outline-color: ${({ theme }) => theme.palette.divider};
57
57
  border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
58
58
  overflow: hidden;
59
59
  }
60
60
  [class*='MUIDataTable-responsiveBase'] {
61
61
  outline: 1px solid;
62
- outline-color: ${({ theme }) => theme.palette.grey[100]};
62
+ outline-color: ${({ theme }) => theme.palette.divider};
63
63
  border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
64
64
  }
65
65
 
@@ -22,7 +22,10 @@ function UserCreditCard({ baseUrl, apiKey, onSuccess = () => { }, onError = () =
22
22
  },
23
23
  });
24
24
  if (loading) {
25
- return (_jsxs(Box, { sx: { p: 2, textAlign: 'center' }, children: [_jsx(CircularProgress, { size: 24 }), _jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: t('loadingUserInfo') })] }));
25
+ return (_jsxs(Box, { sx: { p: 2, textAlign: 'center' }, children: [_jsx(CircularProgress, { size: 24 }), _jsx(Typography, { variant: "body2", sx: {
26
+ color: 'text.secondary',
27
+ mt: 1,
28
+ }, children: t('loadingUserInfo') })] }));
26
29
  }
27
30
  if (!userInfoData) {
28
31
  return (_jsx(Box, { sx: { p: 2 }, children: _jsx(Alert, { severity: "info", sx: { fontSize: '0.875rem' }, children: t('noUserData') }) }));
@@ -30,13 +33,33 @@ function UserCreditCard({ baseUrl, apiKey, onSuccess = () => { }, onError = () =
30
33
  if (mode === 'custom') {
31
34
  return render(userInfoData);
32
35
  }
33
- return (_jsxs(Stack, { sx: { p: 2, border: '1px solid', borderColor: 'divider', borderRadius: 2, width: '100%' }, spacing: 2, className: "user-credit-card", children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(Typography, { variant: "body2", color: "text.secondary", children: t('username') }), _jsx(UserCard, { user: userInfoData.user, showHoverCard: true, popupShowDid: true, sx: {
36
+ return (_jsxs(Stack, { sx: { p: 2, border: '1px solid', borderColor: 'divider', borderRadius: 2, width: '100%' }, spacing: 2, className: "user-credit-card", children: [_jsxs(Stack, { direction: "row", sx: {
37
+ justifyContent: 'space-between',
38
+ alignItems: 'center',
39
+ }, children: [_jsx(Typography, { variant: "body2", sx: {
40
+ color: 'text.secondary',
41
+ }, children: t('username') }), _jsx(UserCard, { user: userInfoData.user, showHoverCard: true, popupShowDid: true, sx: {
34
42
  border: 'none',
35
43
  p: 0,
36
44
  minWidth: 0,
37
45
  }, avatarProps: {
38
46
  size: 24,
39
- } })] }), (userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.enableCredit) ? (_jsxs(_Fragment, { children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(Typography, { variant: "body2", color: "text.secondary", children: t('creditBalance') }), _jsx(Typography, { variant: "h6", fontWeight: "bold", children: formatNumber(((_a = userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.creditBalance) === null || _a === void 0 ? void 0 : _a.balance) || '0') })] }), ((_b = userInfoData.creditBalance) === null || _b === void 0 ? void 0 : _b.pendingCredit) && Number(userInfoData.creditBalance.pendingCredit) > 0 && (_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(Typography, { variant: "body2", color: "text.secondary", children: t('pendingCredit') }), _jsx(Typography, { variant: "h6", fontWeight: "bold", sx: { color: 'error.main' }, children: formatNumber(userInfoData.creditBalance.pendingCredit) })] })), _jsxs(Stack, { direction: "row", spacing: 1.5, sx: { mt: 1 }, className: "user-credit-card-actions", children: [(userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) && (_jsx(Button, { variant: "outlined", className: "recharge-button", onClick: () => {
47
+ } })] }), (userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.enableCredit) ? (_jsxs(_Fragment, { children: [_jsxs(Stack, { direction: "row", sx: {
48
+ justifyContent: 'space-between',
49
+ alignItems: 'center',
50
+ }, children: [_jsx(Typography, { variant: "body2", sx: {
51
+ color: 'text.secondary',
52
+ }, children: t('creditBalance') }), _jsx(Typography, { variant: "h6", sx: {
53
+ fontWeight: 'bold',
54
+ }, children: formatNumber(((_a = userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.creditBalance) === null || _a === void 0 ? void 0 : _a.balance) || '0') })] }), ((_b = userInfoData.creditBalance) === null || _b === void 0 ? void 0 : _b.pendingCredit) && Number(userInfoData.creditBalance.pendingCredit) > 0 && (_jsxs(Stack, { direction: "row", sx: {
55
+ justifyContent: 'space-between',
56
+ alignItems: 'center',
57
+ }, children: [_jsx(Typography, { variant: "body2", sx: {
58
+ color: 'text.secondary',
59
+ }, children: t('pendingCredit') }), _jsx(Typography, { variant: "h6", sx: {
60
+ fontWeight: 'bold',
61
+ color: 'error.main',
62
+ }, children: formatNumber(userInfoData.creditBalance.pendingCredit) })] })), _jsxs(Stack, { direction: "row", spacing: 1.5, sx: { mt: 1 }, className: "user-credit-card-actions", children: [(userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) && (_jsx(Button, { variant: "outlined", className: "recharge-button", onClick: () => {
40
63
  window.open((userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.paymentLink) || '', '_blank');
41
64
  }, sx: {
42
65
  flex: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/aigne-hub",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "The react.js component library for AIGNE Hub",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -100,11 +100,11 @@
100
100
  "react": "^18.2.0"
101
101
  },
102
102
  "dependencies": {
103
- "@arcblock/did": "^1.21.2",
104
- "@arcblock/ux": "^3.1.5",
103
+ "@arcblock/did": "^1.21.3",
104
+ "@arcblock/ux": "^3.1.10",
105
105
  "@blocklet/error": "0.2.5",
106
106
  "@blocklet/logger": "^1.16.48",
107
- "@blocklet/payment-js": "^1.19.15",
107
+ "@blocklet/payment-js": "^1.19.17",
108
108
  "@blocklet/sdk": "^1.16.48",
109
109
  "@emotion/css": "^11.13.5",
110
110
  "@emotion/react": "^11.14.0",
@@ -113,8 +113,8 @@
113
113
  "@mui/lab": "^7.0.0-beta.14",
114
114
  "@mui/material": "^7.2.0",
115
115
  "@mui/system": "^7.2.0",
116
- "@ocap/mcrypto": "^1.21.2",
117
- "@ocap/util": "^1.21.2",
116
+ "@ocap/mcrypto": "^1.21.3",
117
+ "@ocap/util": "^1.21.3",
118
118
  "@types/express": "^5.0.3",
119
119
  "ahooks": "^3.8.1",
120
120
  "axios": "^1.7.4",