@abtnode/ux 1.16.28 → 1.16.29-beta-e04c6f40

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 (44) hide show
  1. package/lib/blocklet/add-cert.js +2 -2
  2. package/lib/blocklet/component/add-component/add-component-core.js +2 -2
  3. package/lib/blocklet/component/did-space/connect-to.js +2 -2
  4. package/lib/blocklet/install-from-url.js +2 -2
  5. package/lib/blocklet/migration.js +2 -2
  6. package/lib/blocklet/notification/push-kit.js +17 -3
  7. package/lib/blocklet/publish/create-release/blocklets.js +1 -1
  8. package/lib/blocklet/publish/create-release/branding.js +2 -1
  9. package/lib/blocklet/publish/create-release/connect-store-button.js +99 -23
  10. package/lib/blocklet/publish/create-release/connect-store-list.js +37 -29
  11. package/lib/blocklet/publish/create-release/index.js +5 -2
  12. package/lib/blocklet/publish/release-list.js +2 -1
  13. package/lib/blocklet/storage/connect-to.js +2 -2
  14. package/lib/blocklet/transfer-owner.js +2 -2
  15. package/lib/hooks/use-navigation.js +31 -2
  16. package/lib/invitation/invitation-receive.js +46 -25
  17. package/lib/invitation/invitation.js +4 -4
  18. package/lib/locales/ar.js +15 -4
  19. package/lib/locales/de.js +15 -4
  20. package/lib/locales/en.js +14 -3
  21. package/lib/locales/es.js +15 -4
  22. package/lib/locales/fr.js +15 -4
  23. package/lib/locales/hi.js +15 -4
  24. package/lib/locales/i18n.db +0 -0
  25. package/lib/locales/id.js +15 -4
  26. package/lib/locales/ja.js +15 -4
  27. package/lib/locales/ko.js +15 -4
  28. package/lib/locales/pt.js +15 -4
  29. package/lib/locales/ru.js +15 -4
  30. package/lib/locales/th.js +15 -4
  31. package/lib/locales/vi.js +15 -4
  32. package/lib/locales/zh-tw.js +15 -4
  33. package/lib/locales/zh.js +15 -4
  34. package/lib/store/add.js +31 -13
  35. package/lib/store/connect-actions.js +18 -18
  36. package/lib/store/item.js +30 -5
  37. package/lib/team/members/index.js +33 -1
  38. package/lib/team/members/invite-member.js +99 -67
  39. package/lib/team/members/issue-passport.js +2 -2
  40. package/lib/team/members/transfer-node.js +5 -5
  41. package/lib/team/passports/mutate-role.js +2 -2
  42. package/lib/util/index.js +1 -1
  43. package/lib/util/sdk.js +3 -0
  44. package/package.json +8 -7
@@ -1,18 +1,11 @@
1
- import { useState } from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from '@emotion/styled';
2
+ import { Alert, Box, CircularProgress, DialogContentText, MenuItem, Select, TextField, InputLabel, FormControl } from '@mui/material';
3
+ import { useReactive } from 'ahooks';
4
4
  import Dialog from '@arcblock/ux/lib/Dialog';
5
- import Spinner from '@mui/material/CircularProgress';
6
- import DialogContentText from '@mui/material/DialogContentText';
7
- import Typography from '@mui/material/Typography';
8
- import MenuItem from '@mui/material/MenuItem';
9
- import Select from '@mui/material/Select';
10
- import TextField from '@mui/material/TextField';
11
- import InputLabel from '@mui/material/InputLabel';
12
- import FormControl from '@mui/material/FormControl';
13
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
14
6
  import Button from '@arcblock/ux/lib/Button';
15
- import Alert from '@arcblock/ux/lib/Alert';
7
+ import DID from '@arcblock/ux/lib/DID';
8
+ import Avatar from '@arcblock/ux/lib/Avatar';
16
9
  import ClickToCopy from '../../click-to-copy';
17
10
  import { useNodeContext } from '../../contexts/node';
18
11
  import { formatError, getInviteLink, formatToDatetime } from '../../util';
@@ -20,6 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
20
13
  export default function InviteMember({
21
14
  teamDid,
22
15
  roles,
16
+ apps,
23
17
  onCancel,
24
18
  onSuccess,
25
19
  onError,
@@ -28,64 +22,110 @@ export default function InviteMember({
28
22
  const {
29
23
  api
30
24
  } = useNodeContext();
31
- const [loading, setLoading] = useState(false);
32
- const [error, setError] = useState('');
33
25
  const {
34
26
  t,
35
27
  locale
36
28
  } = useLocaleContext();
37
- const [activeStep, setActiveStep] = useState(0);
38
- const [inviteInfo, setInviteInfo] = useState('');
39
- const [role, setRole] = useState('');
40
- const [remark, setRemark] = useState('');
29
+ const currentState = useReactive({
30
+ loading: false,
31
+ error: null,
32
+ activeStep: 0,
33
+ inviteInfo: null,
34
+ role: '',
35
+ remark: '',
36
+ sourceAppPid: apps.length > 0 ? apps[0].appId : null
37
+ });
41
38
  const onCreate = async () => {
42
- if (!role) {
43
- setError(t('team.member.error.passportEmpty'));
39
+ if (!currentState.role) {
40
+ currentState.error = t('team.member.error.passportEmpty');
44
41
  return;
45
42
  }
46
- const trimRemark = remark.trim();
47
- setError(null);
48
- setLoading(true);
43
+ const trimRemark = currentState.remark.trim();
44
+ currentState.error = null;
45
+ currentState.loading = true;
49
46
  try {
50
47
  const {
51
- inviteInfo: info
48
+ inviteInfo
52
49
  } = await api.createMemberInvitation({
53
50
  input: {
54
51
  teamDid,
55
- role,
56
- remark: trimRemark
52
+ role: currentState.role,
53
+ remark: trimRemark,
54
+ sourceAppPid: currentState.sourceAppPid
57
55
  }
58
56
  });
59
- setInviteInfo(info);
60
- setActiveStep(1);
57
+ currentState.inviteInfo = inviteInfo;
58
+ currentState.activeStep = 1;
61
59
  } catch (err) {
62
60
  const errMsg = formatError(err);
63
- setError(errMsg);
61
+ currentState.error = errMsg;
64
62
  onError(err);
65
63
  } finally {
66
- setLoading(false);
64
+ currentState.loading = false;
67
65
  }
68
66
  };
69
67
  const steps = [{
70
- body: /*#__PURE__*/_jsxs(Typography, {
71
- component: "div",
72
- children: [/*#__PURE__*/_jsxs(FormControl, {
73
- style: {
74
- width: '100%'
75
- },
68
+ body: /*#__PURE__*/_jsxs(Box, {
69
+ sx: {
70
+ display: 'flex',
71
+ flexDirection: 'column',
72
+ gap: 3
73
+ },
74
+ children: [apps.length > 1 ? /*#__PURE__*/_jsxs(FormControl, {
75
+ fullWidth: true,
76
+ children: [/*#__PURE__*/_jsx(InputLabel, {
77
+ children: t('common.sourceApp')
78
+ }), /*#__PURE__*/_jsx(Select, {
79
+ value: currentState.sourceAppPid,
80
+ onChange: e => {
81
+ currentState.error = null;
82
+ currentState.sourceAppPid = e.target.value;
83
+ },
84
+ fullWidth: true,
85
+ label: t('common.passport'),
86
+ disabled: currentState.loading,
87
+ children: apps.map(r => /*#__PURE__*/_jsx(MenuItem, {
88
+ value: r.appId,
89
+ children: /*#__PURE__*/_jsxs(Box, {
90
+ sx: {
91
+ display: 'flex',
92
+ justifyContent: 'space-between',
93
+ gap: 2,
94
+ width: '100%'
95
+ },
96
+ children: [/*#__PURE__*/_jsxs(Box, {
97
+ sx: {
98
+ display: 'flex',
99
+ alignItems: 'center',
100
+ gap: 1
101
+ },
102
+ children: [/*#__PURE__*/_jsx(Avatar, {
103
+ did: r.appId,
104
+ size: 28
105
+ }), r.appName]
106
+ }), /*#__PURE__*/_jsx(DID, {
107
+ did: r.appId,
108
+ compact: true,
109
+ responsive: false
110
+ })]
111
+ })
112
+ }, r.appId))
113
+ })]
114
+ }) : null, /*#__PURE__*/_jsxs(FormControl, {
115
+ fullWidth: true,
76
116
  variant: "outlined",
77
117
  children: [/*#__PURE__*/_jsx(InputLabel, {
78
118
  children: t('common.passport')
79
119
  }), /*#__PURE__*/_jsx(Select, {
80
120
  "data-cy": "invite-member-select-role",
81
- value: role,
121
+ value: currentState.role,
82
122
  onChange: e => {
83
- setError(null);
84
- setRole(e.target.value);
123
+ currentState.error = null;
124
+ currentState.role = e.target.value;
85
125
  },
86
126
  fullWidth: true,
87
127
  label: t('common.passport'),
88
- disabled: loading,
128
+ disabled: currentState.loading,
89
129
  onKeyPress: e => {
90
130
  if (e.key === 'Enter') {
91
131
  e.preventDefault();
@@ -100,11 +140,6 @@ export default function InviteMember({
100
140
  })
101
141
  }, r.name))
102
142
  })]
103
- }), /*#__PURE__*/_jsx("div", {
104
- style: {
105
- marginTop: 20,
106
- marginBottom: 10
107
- }
108
143
  }), /*#__PURE__*/_jsx(TextField, {
109
144
  label: t('common.remark'),
110
145
  autoComplete: "off",
@@ -113,18 +148,13 @@ export default function InviteMember({
113
148
  style: {
114
149
  marginBottom: 8
115
150
  },
116
- value: remark,
151
+ value: currentState.remark,
117
152
  onChange: e => {
118
- setError(null);
119
- setRemark(e.target.value);
153
+ currentState.error = null;
154
+ currentState.remark = e.target.value;
120
155
  },
121
- disabled: loading,
156
+ disabled: currentState.loading,
122
157
  "data-cy": "invite-member-input-remark"
123
- }), /*#__PURE__*/_jsx("div", {
124
- style: {
125
- marginTop: 20,
126
- marginBottom: 10
127
- }
128
158
  })]
129
159
  }),
130
160
  cancel: t('common.cancel'),
@@ -135,13 +165,17 @@ export default function InviteMember({
135
165
  // eslint-disable-next-line react/no-unstable-nested-components
136
166
  body: () => {
137
167
  const link = getInviteLink({
138
- inviteId: inviteInfo.inviteId,
168
+ inviteId: currentState.inviteInfo?.inviteId,
139
169
  endpoint
140
170
  });
141
171
  return /*#__PURE__*/_jsxs("div", {
142
- children: [/*#__PURE__*/_jsx(Bold, {
172
+ children: [/*#__PURE__*/_jsx(Box, {
173
+ sx: {
174
+ fontSize: 16,
175
+ fontWeight: 'bold'
176
+ },
143
177
  children: t('team.member.inviteDialog.createSuccessTip', {
144
- expireDate: formatToDatetime(inviteInfo.expireDate, locale)
178
+ expireDate: formatToDatetime(currentState.inviteInfo?.expireDate, locale)
145
179
  })
146
180
  }), /*#__PURE__*/_jsx("div", {
147
181
  style: {
@@ -155,7 +189,7 @@ export default function InviteMember({
155
189
  confirm: t('common.confirm'),
156
190
  onConfirm: onSuccess
157
191
  }];
158
- const step = steps[activeStep];
192
+ const step = steps[currentState.activeStep];
159
193
  return /*#__PURE__*/_jsxs(Dialog, {
160
194
  title: t('common.invite'),
161
195
  fullWidth: true,
@@ -169,10 +203,10 @@ export default function InviteMember({
169
203
  }), /*#__PURE__*/_jsxs(Button, {
170
204
  onClick: step.onConfirm,
171
205
  color: "primary",
172
- disabled: loading || !role,
206
+ disabled: currentState.loading || !currentState.role,
173
207
  variant: "contained",
174
208
  autoFocus: true,
175
- children: [loading && /*#__PURE__*/_jsx(Spinner, {
209
+ children: [currentState.loading && /*#__PURE__*/_jsx(CircularProgress, {
176
210
  size: 16
177
211
  }), step.confirm]
178
212
  })]
@@ -180,10 +214,10 @@ export default function InviteMember({
180
214
  children: [/*#__PURE__*/_jsx(DialogContentText, {
181
215
  component: "div",
182
216
  children: typeof step.body === 'function' ? step.body() : step.body
183
- }), !!error && /*#__PURE__*/_jsx(Alert, {
184
- type: "error",
217
+ }), !!currentState.error && /*#__PURE__*/_jsx(Alert, {
218
+ severity: "error",
185
219
  variant: "icon",
186
- children: error
220
+ children: currentState.error
187
221
  })]
188
222
  });
189
223
  }
@@ -193,14 +227,12 @@ InviteMember.propTypes = {
193
227
  onSuccess: PropTypes.func.isRequired,
194
228
  onError: PropTypes.func,
195
229
  roles: PropTypes.array,
230
+ apps: PropTypes.array,
196
231
  endpoint: PropTypes.string
197
232
  };
198
233
  InviteMember.defaultProps = {
199
234
  onError: () => {},
200
235
  roles: [],
236
+ apps: [],
201
237
  endpoint: ''
202
- };
203
- const Bold = styled.div`
204
- font-size: 16px;
205
- font-weight: bold;
206
- `;
238
+ };
@@ -10,7 +10,7 @@ import InputLabel from '@mui/material/InputLabel';
10
10
  import FormControl from '@mui/material/FormControl';
11
11
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
12
12
  import Button from '@arcblock/ux/lib/Button';
13
- import Alert from '@arcblock/ux/lib/Alert';
13
+ import Alert from '@mui/material/Alert';
14
14
  import { useNodeContext } from '../../contexts/node';
15
15
  import { formatError } from '../../util';
16
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -126,7 +126,7 @@ export default function IssuePassport({
126
126
  })
127
127
  })
128
128
  }), !!error && /*#__PURE__*/_jsx(Alert, {
129
- type: "error",
129
+ severity: "error",
130
130
  variant: "icon",
131
131
  children: error
132
132
  })]
@@ -12,7 +12,7 @@ import TextField from '@mui/material/TextField';
12
12
  import Connect from '@arcblock/did-connect/lib/Connect';
13
13
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
14
14
  import Button from '@arcblock/ux/lib/Button';
15
- import Alert from '@arcblock/ux/lib/Alert';
15
+ import Alert from '@mui/material/Alert';
16
16
  import ClickToCopy from '../../click-to-copy';
17
17
  import { useNodeContext } from '../../contexts/node';
18
18
  import { formatError, getInviteLink, formatToDatetime, getWebWalletUrl } from '../../util';
@@ -76,7 +76,7 @@ export default function TransferMember({
76
76
  open: true,
77
77
  onClose: onCancel,
78
78
  children: /*#__PURE__*/_jsx(Alert, {
79
- type: "error",
79
+ severity: "error",
80
80
  variant: "icon",
81
81
  children: formatError(delegationState.error)
82
82
  })
@@ -118,14 +118,14 @@ export default function TransferMember({
118
118
  body: /*#__PURE__*/_jsxs(Typography, {
119
119
  component: "div",
120
120
  children: [/*#__PURE__*/_jsxs(Alert, {
121
- type: "warning",
121
+ severity: "warning",
122
122
  children: [/*#__PURE__*/_jsx(Typography, {
123
123
  children: t('team.transferNode.inviteDialog.tips.progress')
124
124
  }), /*#__PURE__*/_jsx(Typography, {
125
125
  children: t('team.transferNode.inviteDialog.tips.newOwnerPermissions')
126
126
  })]
127
127
  }), /*#__PURE__*/_jsx(Alert, {
128
- type: "warning",
128
+ severity: "warning",
129
129
  children: /*#__PURE__*/_jsx(Typography, {
130
130
  children: t('team.transferNode.inviteDialog.tips.revoke')
131
131
  })
@@ -232,7 +232,7 @@ export default function TransferMember({
232
232
  component: "div",
233
233
  children: typeof step.body === 'function' ? step.body() : step.body
234
234
  }), !!error && /*#__PURE__*/_jsx(Alert, {
235
- type: "error",
235
+ severity: "error",
236
236
  variant: "icon",
237
237
  children: error
238
238
  })]
@@ -8,7 +8,7 @@ import Typography from '@mui/material/Typography';
8
8
  import TextField from '@mui/material/TextField';
9
9
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
10
10
  import Button from '@arcblock/ux/lib/Button';
11
- import Alert from '@arcblock/ux/lib/Alert';
11
+ import Alert from '@mui/material/Alert';
12
12
  import { useNodeContext } from '../../contexts/node';
13
13
  import { formatError } from '../../util';
14
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -171,7 +171,7 @@ export default function MutateRole({
171
171
  component: "div",
172
172
  children: body
173
173
  }), !!error && /*#__PURE__*/_jsx(Alert, {
174
- type: "error",
174
+ severity: "error",
175
175
  variant: "icon",
176
176
  style: {
177
177
  width: '100%',
package/lib/util/index.js CHANGED
@@ -595,7 +595,7 @@ export const getStoreList = ({
595
595
  const storeList = fromBlocklet ? blocklet?.settings?.storeList || [] : nodeInfo?.blockletRegistryList || [];
596
596
  return {
597
597
  teamDid,
598
- storeList
598
+ storeList: storeList.filter(x => !x.scope || x.scope !== 'studio')
599
599
  };
600
600
  };
601
601
  const isDidDomainOrIpEchoDomain = domain => {
@@ -0,0 +1,3 @@
1
+ import { BlockletSDK } from '@blocklet/js-sdk';
2
+ const blockletSdk = new BlockletSDK();
3
+ export default blockletSdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.28",
3
+ "version": "1.16.29-beta-e04c6f40",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,9 +25,9 @@
25
25
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@abtnode/auth": "1.16.28",
29
- "@abtnode/constant": "1.16.28",
30
- "@abtnode/util": "1.16.28",
28
+ "@abtnode/auth": "1.16.29-beta-e04c6f40",
29
+ "@abtnode/constant": "1.16.29-beta-e04c6f40",
30
+ "@abtnode/util": "1.16.29-beta-e04c6f40",
31
31
  "@ahooksjs/use-url-state": "^3.5.1",
32
32
  "@arcblock/did": "^1.18.123",
33
33
  "@arcblock/did-connect": "^2.10.0",
@@ -37,10 +37,11 @@
37
37
  "@arcblock/react-hooks": "^2.10.0",
38
38
  "@arcblock/terminal": "^2.10.0",
39
39
  "@arcblock/ux": "^2.10.0",
40
- "@blocklet/constant": "1.16.28",
40
+ "@blocklet/constant": "1.16.29-beta-e04c6f40",
41
+ "@blocklet/js-sdk": "1.16.29-beta-e04c6f40",
41
42
  "@blocklet/launcher-layout": "2.3.22",
42
43
  "@blocklet/list": "^0.12.114",
43
- "@blocklet/meta": "1.16.28",
44
+ "@blocklet/meta": "1.16.29-beta-e04c6f40",
44
45
  "@blocklet/ui-react": "^2.10.0",
45
46
  "@blocklet/uploader": "^0.1.10",
46
47
  "@emotion/react": "^11.10.4",
@@ -107,5 +108,5 @@
107
108
  "jest": "^29.7.0",
108
109
  "jest-environment-jsdom": "^29.7.0"
109
110
  },
110
- "gitHead": "54db076a7e520bbc260f8cbf0af31dd50b86aef1"
111
+ "gitHead": "f3e8f2ce931215b95ada33e87aee997d8ae52a69"
111
112
  }