@abtnode/ux 1.16.14-beta-c308dc3b → 1.16.14-beta-963cb583

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 (213) hide show
  1. package/es/actions.js +97 -0
  2. package/es/analytics/card.js +92 -0
  3. package/es/analytics/chart.js +96 -0
  4. package/es/analytics/cpu.js +36 -0
  5. package/es/analytics/disk.js +111 -0
  6. package/es/analytics/memory.js +72 -0
  7. package/es/analytics/runtime.js +173 -0
  8. package/es/analytics/traffic.js +259 -0
  9. package/es/blocklet/access/config-access.js +307 -0
  10. package/es/blocklet/access/index.js +216 -0
  11. package/es/blocklet/actions.js +474 -0
  12. package/es/blocklet/add-cert.js +177 -0
  13. package/es/blocklet/agreement-app.js +21 -0
  14. package/es/blocklet/agreement.js +127 -0
  15. package/es/blocklet/app-avatar.js +57 -0
  16. package/es/blocklet/audit-logs.js +259 -0
  17. package/es/blocklet/blocklet-source.js +48 -0
  18. package/es/blocklet/bundle-avatar.js +64 -0
  19. package/es/blocklet/component/add.js +1313 -0
  20. package/es/blocklet/component/configuration.js +122 -0
  21. package/es/blocklet/component/delete.js +134 -0
  22. package/es/blocklet/component/environment.js +370 -0
  23. package/es/blocklet/component/index.js +975 -0
  24. package/es/blocklet/component/line.js +20 -0
  25. package/es/blocklet/component/navigation/locale-tabs.js +225 -0
  26. package/es/blocklet/component/navigation/navigation-actions.js +112 -0
  27. package/es/blocklet/component/navigation/navigation-dialog.js +607 -0
  28. package/es/blocklet/component/navigation/navigation-preview.js +101 -0
  29. package/es/blocklet/component/navigation/simple-select.js +124 -0
  30. package/es/blocklet/component/select-store.js +155 -0
  31. package/es/blocklet/component/selected/index.js +94 -0
  32. package/es/blocklet/component/setting.js +109 -0
  33. package/es/blocklet/component/sortable-tree.js +126 -0
  34. package/es/blocklet/component/space-connector.js +199 -0
  35. package/es/blocklet/component/space-selector.js +178 -0
  36. package/es/blocklet/component/start.js +101 -0
  37. package/es/blocklet/component/store-blocklet-list.js +200 -0
  38. package/es/blocklet/component/switch-control.js +57 -0
  39. package/es/blocklet/config-navigation.js +331 -0
  40. package/es/blocklet/configuration.js +603 -0
  41. package/es/blocklet/disk-info.js +75 -0
  42. package/es/blocklet/icons.js +18 -0
  43. package/es/blocklet/install-from-url.js +337 -0
  44. package/es/blocklet/log.js +90 -0
  45. package/es/blocklet/migration.js +149 -0
  46. package/es/blocklet/mode.js +19 -0
  47. package/es/blocklet/notification/email.js +257 -0
  48. package/es/blocklet/notification/index.js +49 -0
  49. package/es/blocklet/oauth/auth0.js +145 -0
  50. package/es/blocklet/oauth/common-settings.js +133 -0
  51. package/es/blocklet/oauth/federated-detail-dialog.js +175 -0
  52. package/es/blocklet/oauth/federated-invite-dialog.js +83 -0
  53. package/es/blocklet/oauth/federated-join-dialog.js +111 -0
  54. package/es/blocklet/oauth/federated-site-list.js +338 -0
  55. package/es/blocklet/oauth/federated.js +81 -0
  56. package/es/blocklet/oauth/index.js +69 -0
  57. package/es/blocklet/overview.js +293 -0
  58. package/es/blocklet/page-group.js +19 -0
  59. package/es/blocklet/preferences/app-sk.js +142 -0
  60. package/es/blocklet/preferences/index.js +305 -0
  61. package/es/blocklet/purchase/common.js +95 -0
  62. package/es/blocklet/purchase/component-purchase.js +237 -0
  63. package/es/blocklet/purchase/index.js +4 -0
  64. package/es/blocklet/router/action/add-domain-alias.js +167 -0
  65. package/es/blocklet/router/action/add-rule.js +211 -0
  66. package/es/blocklet/router/action/config-routing-rule.js +232 -0
  67. package/es/blocklet/router/action/delete-domain-alias.js +99 -0
  68. package/es/blocklet/router/action/delete-rule.js +108 -0
  69. package/es/blocklet/router/action/update-rule.js +209 -0
  70. package/es/blocklet/router/domain-actions.js +64 -0
  71. package/es/blocklet/router/domain-status.js +88 -0
  72. package/es/blocklet/router/rule-actions.js +66 -0
  73. package/es/blocklet/router/rule-list.js +190 -0
  74. package/es/blocklet/router/util.js +131 -0
  75. package/es/blocklet/runtime-info.js +68 -0
  76. package/es/blocklet/status.js +91 -0
  77. package/es/blocklet/storage/action.js +134 -0
  78. package/es/blocklet/storage/backups.js +241 -0
  79. package/es/blocklet/storage/connect-to.js +372 -0
  80. package/es/blocklet/storage/connected.js +198 -0
  81. package/es/blocklet/storage/delete.js +113 -0
  82. package/es/blocklet/storage/disconnect.js +243 -0
  83. package/es/blocklet/storage/index.js +19 -0
  84. package/es/blocklet/storage/item.js +558 -0
  85. package/es/blocklet/storage/preview-nft.js +286 -0
  86. package/es/blocklet/transfer-owner.js +198 -0
  87. package/es/blocklet/types.js +18 -0
  88. package/es/blocklet/util.js +145 -0
  89. package/es/blocklet/version.js +141 -0
  90. package/es/card-selector.js +134 -0
  91. package/es/certificate.js +105 -0
  92. package/es/chain.js +13 -0
  93. package/es/click-to-copy.js +22 -0
  94. package/es/confirm.js +149 -0
  95. package/es/contexts/audit-log.js +152 -0
  96. package/es/contexts/blocklet.js +10 -0
  97. package/es/contexts/deleting-blocklets.js +70 -0
  98. package/es/contexts/node.js +17 -0
  99. package/es/contexts/session.js +8 -0
  100. package/es/contexts/team.js +10 -0
  101. package/es/delete-confirm.js +121 -0
  102. package/es/did-address.js +46 -0
  103. package/es/dot.js +14 -0
  104. package/es/exchange-passport.js +102 -0
  105. package/es/form/form-select-input.js +184 -0
  106. package/es/form/form-text-input.js +178 -0
  107. package/es/form/form-wrapper.js +88 -0
  108. package/es/form/input-triggers.js +98 -0
  109. package/es/form/required.js +8 -0
  110. package/es/hooks/blocklet.js +229 -0
  111. package/es/hooks/confirm.js +90 -0
  112. package/es/hooks/mobile-width.js +11 -0
  113. package/es/hooks/url-evaluation.js +155 -0
  114. package/es/hooks/use-app-logo.js +16 -0
  115. package/es/hooks/use-backup-progress.js +31 -0
  116. package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +50 -0
  117. package/es/hooks/use-bundle-logo.js +27 -0
  118. package/es/hooks/use-navigation.js +347 -0
  119. package/es/hooks/use-passport-id.js +14 -0
  120. package/es/hooks/use-subscription.js +22 -0
  121. package/es/icons/empty-space-nft.svg +59 -0
  122. package/es/icons/empty-spaces-nft.svg +58 -0
  123. package/es/icons/long-arrow.svg +5 -0
  124. package/es/icons/space-connected.svg +3 -0
  125. package/es/icons/space-disconnect.svg +3 -0
  126. package/es/index.js +3 -0
  127. package/es/invitation/invitation-app.js +58 -0
  128. package/es/invitation/invitation-login.js +68 -0
  129. package/es/invitation/invitation-passport.js +146 -0
  130. package/es/invitation/invitation-receive.js +138 -0
  131. package/es/invitation/invitation-success.js +93 -0
  132. package/es/invitation/invitation-user.js +90 -0
  133. package/es/invitation/invitation.js +90 -0
  134. package/es/issue-passport.js +142 -0
  135. package/es/launch-blocklet/content-layout.js +58 -0
  136. package/es/launch-blocklet/page-header.js +43 -0
  137. package/es/layout/addon.js +114 -0
  138. package/es/layout/feedback.js +55 -0
  139. package/es/locales/en.js +1541 -0
  140. package/es/locales/index.js +9 -0
  141. package/es/locales/zh.js +1544 -0
  142. package/es/logs/clock.js +11 -0
  143. package/es/logs/download.js +132 -0
  144. package/es/logs/log-terminal.js +253 -0
  145. package/es/lost-passport.js +452 -0
  146. package/es/nav-logo.js +219 -0
  147. package/es/passport-tag.js +43 -0
  148. package/es/permission.js +57 -0
  149. package/es/relative-time.js +53 -0
  150. package/es/result-message.js +11 -0
  151. package/es/schema-form/color-input.js +98 -0
  152. package/es/schema-form/common-prop-types.js +13 -0
  153. package/es/schema-form/index.js +215 -0
  154. package/es/schema-form/passport-input.js +55 -0
  155. package/es/schema-form/text-input.js +57 -0
  156. package/es/store/add.js +179 -0
  157. package/es/store/delete.js +96 -0
  158. package/es/store/item.js +76 -0
  159. package/es/subscription.js +144 -0
  160. package/es/table-icons.js +34 -0
  161. package/es/table.js +52 -0
  162. package/es/tag.js +21 -0
  163. package/es/team/members/actions.js +89 -0
  164. package/es/team/members/index.js +636 -0
  165. package/es/team/members/invitations.js +188 -0
  166. package/es/team/members/invite-member.js +208 -0
  167. package/es/team/members/issue-passport.js +152 -0
  168. package/es/team/members/member.js +408 -0
  169. package/es/team/members/passport-issuances.js +155 -0
  170. package/es/team/members/passports.js +364 -0
  171. package/es/team/members/toggle-user-approval.js +122 -0
  172. package/es/team/members/transfer-node.js +256 -0
  173. package/es/team/members/util.js +14 -0
  174. package/es/team/passports/color.js +127 -0
  175. package/es/team/passports/detail.js +312 -0
  176. package/es/team/passports/index.js +282 -0
  177. package/es/team/passports/mutate-role.js +198 -0
  178. package/es/team/passports/trusted-factories.js +221 -0
  179. package/es/team/passports/trusted-factory.js +343 -0
  180. package/es/team/passports/trusted-issuer.js +296 -0
  181. package/es/team/passports/trusted-issuers.js +226 -0
  182. package/es/team/search-input.js +46 -0
  183. package/es/team/styles/dialog.js +72 -0
  184. package/es/team/styles/list-header.js +31 -0
  185. package/es/util/api.js +6 -0
  186. package/es/util/constants.js +2 -0
  187. package/es/util/index.js +598 -0
  188. package/es/util/mode.js +4 -0
  189. package/es/util/space-gateway.js +51 -0
  190. package/es/util/spaces.js +160 -0
  191. package/es/who-can-access/config.js +38 -0
  192. package/es/wrap-locale.js +15 -0
  193. package/lib/blocklet/component/add.js +5 -0
  194. package/lib/blocklet/component/selected/index.js +47 -0
  195. package/lib/blocklet/component/space-connector.js +1 -1
  196. package/lib/blocklet/component/space-selector.js +1 -1
  197. package/lib/blocklet/storage/backups.js +1 -1
  198. package/lib/blocklet/storage/connect-to.js +6 -7
  199. package/lib/blocklet/storage/connected.js +1 -1
  200. package/lib/blocklet/storage/disconnect.js +1 -1
  201. package/lib/blocklet/storage/index.js +1 -1
  202. package/lib/blocklet/storage/item.js +1 -1
  203. package/lib/card-selector.js +14 -14
  204. package/lib/invitation/invitation-passport.js +7 -6
  205. package/lib/invitation/invitation-receive.js +1 -1
  206. package/lib/locales/en.js +12 -5
  207. package/lib/locales/zh.js +10 -3
  208. package/lib/lost-passport.js +2 -2
  209. package/lib/schema-form/passport-input.js +12 -11
  210. package/lib/team/passports/color.js +14 -14
  211. package/lib/team/passports/trusted-factory.js +1 -1
  212. package/lib/util/spaces.js +13 -1
  213. package/package.json +88 -21
@@ -0,0 +1,179 @@
1
+ import { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { makeStyles } from '@mui/styles';
4
+ import Spinner from '@mui/material/CircularProgress';
5
+ import Dialog from '@arcblock/ux/lib/Dialog';
6
+ import DialogContentText from '@mui/material/DialogContentText';
7
+ import Typography from '@mui/material/Typography';
8
+ import TextField from '@mui/material/TextField';
9
+ import ListItem from '@mui/material/ListItem';
10
+ import AddIcon from '@mui/icons-material/Add';
11
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
12
+ import Button from '@arcblock/ux/lib/Button';
13
+ import Alert from '@arcblock/ux/lib/Alert';
14
+ import { useNodeContext } from '../contexts/node';
15
+ import { formatError, isNewStoreUrl } from '../util';
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { Fragment as _Fragment } from "react/jsx-runtime";
19
+ const useStyles = makeStyles(theme => ({
20
+ addMenuItemRoot: {
21
+ justifyContent: 'center',
22
+ color: theme.palette.primary.main,
23
+ lineHeight: '3.2'
24
+ }
25
+ }));
26
+ export default function AddStore({
27
+ disabled,
28
+ storeList,
29
+ teamDid,
30
+ onAdd
31
+ }) {
32
+ const {
33
+ api
34
+ } = useNodeContext();
35
+ const [loading, setLoading] = useState(false);
36
+ const [disable, setDisable] = useState(true);
37
+ const [open, setOpen] = useState(false);
38
+ const [url, setUrl] = useState('');
39
+ const [error, setError] = useState('');
40
+ const {
41
+ t
42
+ } = useLocaleContext();
43
+ const classes = useStyles();
44
+ const onConfirm = async () => {
45
+ setLoading(true);
46
+ try {
47
+ const {
48
+ isNew,
49
+ decoded
50
+ } = isNewStoreUrl(url, storeList);
51
+ if (!isNew) {
52
+ throw new Error(t('store.blockletRegistry.haveSameRegistry'));
53
+ }
54
+ await api.addBlockletStore({
55
+ input: {
56
+ teamDid,
57
+ url: decoded
58
+ }
59
+ });
60
+ onAdd(decoded);
61
+ setOpen(false);
62
+ } catch (err) {
63
+ const errMsg = `${t('store.blockletRegistry.addFailed')} ${formatError(err)}`;
64
+ setError(errMsg);
65
+ } finally {
66
+ setLoading(false);
67
+ }
68
+ };
69
+ return /*#__PURE__*/_jsxs(_Fragment, {
70
+ children: [/*#__PURE__*/_jsxs(ListItem, {
71
+ button: true,
72
+ disabled: disabled,
73
+ className: classes.addMenuItemRoot,
74
+ onClick: () => {
75
+ setOpen(true);
76
+ },
77
+ children: [/*#__PURE__*/_jsx(AddIcon, {
78
+ font: true
79
+ }), /*#__PURE__*/_jsx(Typography, {
80
+ variant: "inherit",
81
+ children: t('store.blockletRegistry.addRegistry')
82
+ })]
83
+ }), /*#__PURE__*/_jsxs(Dialog, {
84
+ title: t('store.blockletRegistry.addRegistry'),
85
+ fullWidth: true,
86
+ maxWidth: "md",
87
+ open: open,
88
+ onClose: () => setOpen(false),
89
+ PaperProps: {
90
+ style: {
91
+ minHeight: 'auto'
92
+ }
93
+ },
94
+ actions: /*#__PURE__*/_jsxs(_Fragment, {
95
+ children: [/*#__PURE__*/_jsx(Button, {
96
+ onClick: e => {
97
+ e.stopPropagation();
98
+ setOpen(false);
99
+ },
100
+ color: "inherit",
101
+ children: t('common.cancel')
102
+ }), /*#__PURE__*/_jsxs(Button, {
103
+ onClick: e => {
104
+ e.stopPropagation();
105
+ onConfirm();
106
+ },
107
+ color: "primary",
108
+ "data-cy": "install-blocklet-next-step",
109
+ disabled: loading || !url || disable,
110
+ variant: "contained",
111
+ autoFocus: true,
112
+ children: [loading && /*#__PURE__*/_jsx(Spinner, {
113
+ size: 16
114
+ }), t('common.confirm')]
115
+ })]
116
+ }),
117
+ children: [/*#__PURE__*/_jsx("div", {
118
+ style: {
119
+ paddingTop: 12,
120
+ overflowY: 'hidden'
121
+ },
122
+ children: /*#__PURE__*/_jsx(DialogContentText, {
123
+ component: "div",
124
+ children: /*#__PURE__*/_jsx(Typography, {
125
+ component: "div",
126
+ children: /*#__PURE__*/_jsx(TextField, {
127
+ label: t('store.blockletRegistry.registryUrl'),
128
+ autoComplete: "off",
129
+ variant: "outlined",
130
+ name: "url",
131
+ fullWidth: true,
132
+ value: url,
133
+ onChange: e => {
134
+ setError(null);
135
+ let isDisabled = false;
136
+ if (!e.target.value.trim()) {
137
+ isDisabled = true;
138
+ }
139
+ if (!e.target.value.trim()) {
140
+ setError(t('store.blockletRegistry.registryUrlEmpty'));
141
+ }
142
+ setUrl(e.target.value);
143
+ setDisable(isDisabled);
144
+ },
145
+ disabled: loading,
146
+ onKeyPress: e => {
147
+ if (e.key === 'Enter') {
148
+ e.preventDefault();
149
+ if (!e.target.value.trim()) {
150
+ setError(t('store.blockletRegistry.registryUrlEmpty'));
151
+ } else {
152
+ onConfirm();
153
+ }
154
+ }
155
+ }
156
+ })
157
+ })
158
+ })
159
+ }), !!error && /*#__PURE__*/_jsx(Alert, {
160
+ type: "error",
161
+ style: {
162
+ width: '100%'
163
+ },
164
+ children: error
165
+ })]
166
+ })]
167
+ });
168
+ }
169
+ AddStore.propTypes = {
170
+ teamDid: PropTypes.string.isRequired,
171
+ disabled: PropTypes.bool,
172
+ storeList: PropTypes.array,
173
+ onAdd: PropTypes.func
174
+ };
175
+ AddStore.defaultProps = {
176
+ disabled: false,
177
+ storeList: [],
178
+ onAdd: () => {}
179
+ };
@@ -0,0 +1,96 @@
1
+ import { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import IconButton from '@mui/material/IconButton';
4
+ import useTheme from '@mui/material/styles/useTheme';
5
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
+ import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
7
+ import Toast from '@arcblock/ux/lib/Toast';
8
+ import { useNodeContext } from '../contexts/node';
9
+ import DelConfirm from '../delete-confirm';
10
+ import { formatError } from '../util';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ export default function DeleteStore({
15
+ store,
16
+ teamDid,
17
+ onDelete
18
+ }) {
19
+ const {
20
+ api
21
+ } = useNodeContext();
22
+ const {
23
+ t
24
+ } = useLocaleContext();
25
+ const [loading, setLoading] = useState(false);
26
+ const [confirmSetting, setConfirmSetting] = useState(null);
27
+ const theme = useTheme();
28
+ const onCancel = () => {
29
+ setLoading(false);
30
+ setConfirmSetting(null);
31
+ };
32
+ const onConfirm = async () => {
33
+ try {
34
+ setLoading(true);
35
+ await api.deleteBlockletStore({
36
+ input: {
37
+ teamDid,
38
+ url: store.url
39
+ }
40
+ });
41
+ if (onDelete && typeof onDelete === 'function') {
42
+ onDelete();
43
+ }
44
+ } catch (err) {
45
+ Toast.error(`Remove Blocklet Store Error: ${formatError(err)}`);
46
+ } finally {
47
+ setLoading(false);
48
+ setConfirmSetting(null);
49
+ }
50
+ };
51
+ const setting = {
52
+ keyName: store.url,
53
+ title: t('store.blockletRegistry.deleteRegistry'),
54
+ description: t('store.blockletRegistry.deleteDesc', {
55
+ name: `<b>${store.url}</b>`,
56
+ color: theme.palette.error.main
57
+ }),
58
+ confirmPlaceholder: t('store.blockletRegistry.confirmDesc', {
59
+ name: store.url
60
+ }),
61
+ confirm: t('common.delConfirm'),
62
+ cancel: t('common.cancel'),
63
+ onConfirm,
64
+ onCancel
65
+ };
66
+ const onMenuItemClick = e => {
67
+ e.stopPropagation();
68
+ setConfirmSetting(setting);
69
+ };
70
+ return /*#__PURE__*/_jsxs(_Fragment, {
71
+ children: [/*#__PURE__*/_jsx(IconButton, {
72
+ disabled: loading,
73
+ onClick: onMenuItemClick,
74
+ size: "large",
75
+ children: /*#__PURE__*/_jsx(DeleteOutlineIcon, {})
76
+ }), confirmSetting && /*#__PURE__*/_jsx(DelConfirm, {
77
+ keyName: confirmSetting.keyName,
78
+ title: confirmSetting.title,
79
+ description: confirmSetting.description,
80
+ confirmPlaceholder: confirmSetting.confirmPlaceholder,
81
+ confirm: confirmSetting.confirm,
82
+ cancel: confirmSetting.cancel,
83
+ params: confirmSetting.params,
84
+ onConfirm: confirmSetting.onConfirm,
85
+ onCancel: confirmSetting.onCancel
86
+ })]
87
+ });
88
+ }
89
+ DeleteStore.propTypes = {
90
+ teamDid: PropTypes.string.isRequired,
91
+ store: PropTypes.object.isRequired,
92
+ onDelete: PropTypes.func
93
+ };
94
+ DeleteStore.defaultProps = {
95
+ onDelete: () => {}
96
+ };
@@ -0,0 +1,76 @@
1
+ /* eslint-disable react/jsx-one-expression-per-line */
2
+ import { makeStyles } from '@mui/styles';
3
+ import Typography from '@mui/material/Typography';
4
+ import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
5
+ import LaunchIcon from '@mui/icons-material/Launch';
6
+ import IconButton from '@mui/material/IconButton';
7
+ import PropTypes from 'prop-types';
8
+ import DeleteStore from './delete';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ const useStyles = makeStyles(() => ({
12
+ buttonText: {
13
+ textTransform: 'none !important'
14
+ },
15
+ iconRoot: {
16
+ minWidth: 24
17
+ },
18
+ menuName: {
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ marginRight: '100px',
22
+ '& span': {
23
+ overflow: 'hidden',
24
+ textOverflow: 'ellipsis',
25
+ whiteSpace: 'nowrap'
26
+ }
27
+ }
28
+ }));
29
+ export default function StoreItem({
30
+ teamDid,
31
+ store,
32
+ onDelete
33
+ }) {
34
+ const classes = useStyles();
35
+ return /*#__PURE__*/_jsxs("div", {
36
+ className: classes.menuName,
37
+ children: [/*#__PURE__*/_jsx(Typography, {
38
+ component: "span",
39
+ variant: "subtitle1",
40
+ style: {
41
+ fontWeight: '400'
42
+ },
43
+ children: store.name
44
+ }), /*#__PURE__*/_jsx(Typography, {
45
+ className: "url",
46
+ component: "span",
47
+ variant: "inherit",
48
+ children: `${store.url}`
49
+ }), /*#__PURE__*/_jsxs(ListItemSecondaryAction, {
50
+ children: [/*#__PURE__*/_jsx(IconButton, {
51
+ onClick: e => {
52
+ e.stopPropagation();
53
+ window.open(store.url);
54
+ },
55
+ size: "large",
56
+ children: /*#__PURE__*/_jsx(LaunchIcon, {})
57
+ }), !store.protected && /*#__PURE__*/_jsx(DeleteStore, {
58
+ store: store,
59
+ onDelete: onDelete,
60
+ teamDid: teamDid
61
+ })]
62
+ })]
63
+ });
64
+ }
65
+ StoreItem.propTypes = {
66
+ teamDid: PropTypes.string.isRequired,
67
+ store: PropTypes.shape({
68
+ name: PropTypes.string.isRequired,
69
+ url: PropTypes.string.isRequired,
70
+ protected: PropTypes.bool
71
+ }).isRequired,
72
+ onDelete: PropTypes.func
73
+ };
74
+ StoreItem.defaultProps = {
75
+ onDelete: () => {}
76
+ };
@@ -0,0 +1,144 @@
1
+ import prettyMs from 'pretty-ms-i18n';
2
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
3
+ import Chip from '@mui/material/Chip';
4
+ import Box from '@mui/material/Box';
5
+ import Popover from '@mui/material/Popover';
6
+ import CircularProgress from '@mui/material/CircularProgress';
7
+ import dayjs from '@abtnode/util/lib/dayjs';
8
+ import PropTypes from 'prop-types';
9
+ import { useRef } from 'react';
10
+ import useAsyncRetry from 'react-use/lib/useAsyncRetry';
11
+ import useSetState from 'react-use/lib/useSetState';
12
+ import { formatPrettyMsLocale, getAsset, getAssetExpiration, getSubscriptionURL } from './util';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ const ALERT_THRESHOLD_MS = 30 * 24 * 60 * 60 * 1000;
17
+ function Subscription({
18
+ chainHost,
19
+ nftId,
20
+ retention,
21
+ ...props
22
+ }) {
23
+ const {
24
+ t,
25
+ locale
26
+ } = useLocaleContext();
27
+ const [state, setState] = useSetState({
28
+ safeIframeRef: null,
29
+ popoverAnchorEl: null
30
+ });
31
+ const iframeRef = useRef(null);
32
+ const {
33
+ sx = {},
34
+ ...rest
35
+ } = props;
36
+ const assetState = useAsyncRetry(() => getAsset(chainHost, nftId));
37
+ if (assetState.loading) {
38
+ return /*#__PURE__*/_jsxs(Box, {
39
+ sx: {
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ color: 'grey',
43
+ gap: 1,
44
+ ...sx
45
+ },
46
+ ...rest,
47
+ children: [/*#__PURE__*/_jsx(CircularProgress, {
48
+ size: 16
49
+ }), t('expiration.loading')]
50
+ });
51
+ }
52
+ if (assetState.error) {
53
+ console.error(assetState.error);
54
+ return /*#__PURE__*/_jsx(Chip, {
55
+ label: t('expiration.loadFailed'),
56
+ color: "error",
57
+ variant: "success",
58
+ sx: {
59
+ cursor: 'pointer',
60
+ ...sx
61
+ },
62
+ ...rest,
63
+ onClick: () => assetState.retry()
64
+ });
65
+ }
66
+ const expirationDate = getAssetExpiration(assetState.value);
67
+ const launcherUrl = assetState.value?.data?.value?.launcherUrl;
68
+ const isExpired = dayjs(expirationDate).isBefore(dayjs());
69
+ const validityMs = dayjs(expirationDate).diff(dayjs(), 'ms');
70
+ let status = 'success';
71
+ if (validityMs <= ALERT_THRESHOLD_MS) {
72
+ status = 'warning';
73
+ }
74
+ if (isExpired) {
75
+ status = 'error';
76
+ }
77
+ const handlePopoverClick = event => {
78
+ setState({
79
+ popoverAnchorEl: event.currentTarget
80
+ });
81
+ };
82
+ const handlePopoverClose = () => {
83
+ setState({
84
+ popoverAnchorEl: null
85
+ });
86
+ };
87
+ return /*#__PURE__*/_jsxs(_Fragment, {
88
+ children: [/*#__PURE__*/_jsx(Chip, {
89
+ label: t(`expiration.tips.${status}`, {
90
+ validity: prettyMs(validityMs, {
91
+ locale: formatPrettyMsLocale(locale),
92
+ compact: true,
93
+ verbose: true
94
+ })
95
+ }),
96
+ color: status,
97
+ variant: status !== 'success' ? 'contained' : 'outlined',
98
+ sx: {
99
+ cursor: 'pointer',
100
+ ...sx
101
+ },
102
+ ...rest,
103
+ onClick: handlePopoverClick
104
+ }), /*#__PURE__*/_jsx(Popover, {
105
+ id: "popover-info",
106
+ open: Boolean(state.popoverAnchorEl),
107
+ anchorEl: state.popoverAnchorEl,
108
+ onClose: handlePopoverClose,
109
+ anchorOrigin: {
110
+ vertical: 'bottom',
111
+ horizontal: 'right'
112
+ },
113
+ transformOrigin: {
114
+ vertical: 'top',
115
+ horizontal: 'right'
116
+ },
117
+ children: /*#__PURE__*/_jsx("iframe", {
118
+ ref: iframeRef,
119
+ title: t('common.subscription'),
120
+ width: "360px",
121
+ height: "600px",
122
+ style: {
123
+ border: 0
124
+ },
125
+ src: getSubscriptionURL({
126
+ launcherUrl,
127
+ nftId,
128
+ locale
129
+ })
130
+ })
131
+ })]
132
+ });
133
+ }
134
+ Subscription.propTypes = {
135
+ chainHost: PropTypes.string.isRequired,
136
+ nftId: PropTypes.string.isRequired,
137
+ sx: PropTypes.object,
138
+ retention: PropTypes.number
139
+ };
140
+ Subscription.defaultProps = {
141
+ sx: {},
142
+ retention: 0
143
+ };
144
+ export default Subscription;
@@ -0,0 +1,34 @@
1
+ import Add from '@mui/icons-material/Add';
2
+ import Check from '@mui/icons-material/Check';
3
+ import Delete from '@mui/icons-material/Delete';
4
+ import Clear from '@mui/icons-material/Clear';
5
+ import Export from '@mui/icons-material/SaveAlt';
6
+ import Edit from '@mui/icons-material/Edit';
7
+ import Filter from '@mui/icons-material/Filter';
8
+ import FirstPage from '@mui/icons-material/FirstPage';
9
+ import LastPage from '@mui/icons-material/LastPage';
10
+ import NextPage from '@mui/icons-material/ChevronRight';
11
+ import PreviousPage from '@mui/icons-material/ChevronLeft';
12
+ import Search from '@mui/icons-material/Search';
13
+ import SortArrow from '@mui/icons-material/ArrowDropDown';
14
+ import ThirdStateCheck from '@mui/icons-material/Remove';
15
+ import ViewColumn from '@mui/icons-material/ViewColumn';
16
+ export default {
17
+ Add,
18
+ Check,
19
+ Delete,
20
+ Edit,
21
+ Clear,
22
+ DetailPanel: NextPage,
23
+ Filter,
24
+ FirstPage,
25
+ LastPage,
26
+ NextPage,
27
+ PreviousPage,
28
+ Search,
29
+ ResetSearch: Clear,
30
+ SortArrow,
31
+ Export,
32
+ ThirdStateCheck,
33
+ ViewColumn
34
+ };
package/es/table.js ADDED
@@ -0,0 +1,52 @@
1
+ import styled from '@emotion/styled';
2
+ const TableStyle = styled.div`
3
+ .MuiPaper-root {
4
+ box-shadow: none !important;
5
+ border: none !important;
6
+ border-radius: 0 !important;
7
+ background: transparent;
8
+ }
9
+ .MuiToolbar-root {
10
+ background: transparent;
11
+ padding-left: 0;
12
+ display: none;
13
+ }
14
+
15
+ &.show-pagination {
16
+ .MuiTablePagination-toolbar {
17
+ display: flex;
18
+ }
19
+ }
20
+
21
+ .MuiTableHead-root th {
22
+ min-width: 100px;
23
+ background: transparent;
24
+ }
25
+
26
+ .MuiTable-root {
27
+ overflow-y: hidden;
28
+ }
29
+ .MuiTableRow-root {
30
+ border: none !important;
31
+ }
32
+
33
+ .MuiTableCell-root {
34
+ padding-right: 16px;
35
+ &:last-of-type {
36
+ padding-right: 0;
37
+ }
38
+ }
39
+
40
+ /* @material-table/core@next 兼容 mui v5, 但 pagination 样式似乎有些问题, 暂地定制下面的样式修复, 后面考虑弃用 material-table */
41
+ .MuiTablePagination-selectLabel,
42
+ .MuiTablePagination-displayedRows {
43
+ display: none;
44
+ }
45
+ .MuiTypography-caption {
46
+ display: inline-block;
47
+ }
48
+ .MuiTablePagination-selectLabel + .MuiInputBase-root {
49
+ margin-right: 8px;
50
+ }
51
+ `;
52
+ export default TableStyle;
package/es/tag.js ADDED
@@ -0,0 +1,21 @@
1
+ import PropTypes from 'prop-types';
2
+ import Tag from '@arcblock/ux/lib/Tag';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function Wrapped({
5
+ children,
6
+ style,
7
+ ...rest
8
+ }) {
9
+ return /*#__PURE__*/_jsx(Tag, {
10
+ style: style,
11
+ ...rest,
12
+ children: children
13
+ });
14
+ }
15
+ Wrapped.propTypes = {
16
+ children: PropTypes.any.isRequired,
17
+ style: PropTypes.object
18
+ };
19
+ Wrapped.defaultProps = {
20
+ style: {}
21
+ };
@@ -0,0 +1,89 @@
1
+ import { useState, useContext } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import MenuItem from '@mui/material/MenuItem';
4
+ import AddIcon from '@mui/icons-material/Add';
5
+ import ListItemIcon from '@mui/material/ListItemIcon';
6
+ import ListItemText from '@mui/material/ListItemText';
7
+ import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
8
+ import ForbidLoginIcon from '@arcblock/icons/lib/ForbidLoginIcon';
9
+ import AllowLoginIcon from '@arcblock/icons/lib/AllowLoginIcon';
10
+ import { getWalletDid } from '@blocklet/meta/lib/did-utils';
11
+ import { useTeamContext } from '../../contexts/team';
12
+ import Actions from '../../actions';
13
+ import IssuePassport from './issue-passport';
14
+ import ToggleUserApproval from './toggle-user-approval';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
+ export default function MemberActions({
19
+ user,
20
+ onIssuePassport
21
+ }) {
22
+ const {
23
+ teamDid,
24
+ roles
25
+ } = useTeamContext();
26
+ const {
27
+ t
28
+ } = useContext(LocaleContext);
29
+ const [enablePassportIssuance, setEnablePassportIssuance] = useState(false);
30
+ return /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [/*#__PURE__*/_jsx(Actions, {
32
+ "data-cy": "member-actions",
33
+ actions: [{
34
+ icon: /*#__PURE__*/_jsx(AddIcon, {
35
+ fontSize: "small"
36
+ }),
37
+ text: t('team.passport.issue'),
38
+ 'data-cy': 'action-issue-passport',
39
+ onClick: e => {
40
+ e.stopPropagation();
41
+ setEnablePassportIssuance(true);
42
+ }
43
+ },
44
+ // eslint-disable-next-line react/no-unstable-nested-components
45
+ ({
46
+ close
47
+ }) => /*#__PURE__*/_jsx(ToggleUserApproval, {
48
+ user: user,
49
+ children: ({
50
+ open: o
51
+ }) => /*#__PURE__*/_jsxs(MenuItem, {
52
+ dense: true,
53
+ onClick: e => {
54
+ e.stopPropagation();
55
+ close();
56
+ o(e);
57
+ },
58
+ "data-cy": "action-toggle-block",
59
+ children: [/*#__PURE__*/_jsx(ListItemIcon, {
60
+ style: {
61
+ minWidth: 24,
62
+ marginRight: 8
63
+ },
64
+ children: user.approved ? /*#__PURE__*/_jsx(ForbidLoginIcon, {}) : /*#__PURE__*/_jsx(AllowLoginIcon, {})
65
+ }), /*#__PURE__*/_jsx(ListItemText, {
66
+ primary: user.approved ? t('team.member.forbidLogin') : t('team.member.allowLogin')
67
+ })]
68
+ })
69
+ }, "toggle-approval")]
70
+ }), enablePassportIssuance && /*#__PURE__*/_jsx(IssuePassport, {
71
+ teamDid: teamDid,
72
+ ownerDid: user.did,
73
+ needReceive: getWalletDid(user) === user.did,
74
+ roles: roles,
75
+ onCancel: () => setEnablePassportIssuance(false),
76
+ onSuccess: () => {
77
+ onIssuePassport();
78
+ setEnablePassportIssuance(false);
79
+ }
80
+ })]
81
+ });
82
+ }
83
+ MemberActions.propTypes = {
84
+ user: PropTypes.object.isRequired,
85
+ onIssuePassport: PropTypes.func
86
+ };
87
+ MemberActions.defaultProps = {
88
+ onIssuePassport: () => {}
89
+ };