@abtnode/ux 1.8.63 → 1.8.64-beta-0b5ede51

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.
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _get = _interopRequireDefault(require("lodash/get"));
9
+ var _last = _interopRequireDefault(require("lodash/last"));
10
+ var _urlJoin = _interopRequireDefault(require("url-join"));
11
+ var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
12
+ var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
13
+ var _context = require("@arcblock/ux/lib/Locale/context");
14
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
15
+ var _Link = _interopRequireDefault(require("@mui/material/Link"));
16
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
17
+ var _util = require("../../util");
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function Expiration(_ref) {
21
+ var _state$value, _state$value$data, _state$value$data$val;
22
+ let {
23
+ controller
24
+ } = _ref;
25
+ const {
26
+ t,
27
+ locale
28
+ } = (0, _context.useLocaleContext)();
29
+ const state = (0, _useAsync.default)(async () => (0, _util.getAsset)(controller.chainHost, controller.nftId));
30
+ if (state.loading) {
31
+ return '';
32
+ }
33
+ const expirationDate = (0, _last.default)((0, _get.default)(state.value, 'data.value.expirationDate', []));
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
36
+ value: expirationDate,
37
+ locale: locale
38
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
39
+ style: {
40
+ marginLeft: '5px'
41
+ },
42
+ variant: "contained",
43
+ component: _Link.default,
44
+ href: (0, _urlJoin.default)((_state$value = state.value) === null || _state$value === void 0 ? void 0 : (_state$value$data = _state$value.data) === null || _state$value$data === void 0 ? void 0 : (_state$value$data$val = _state$value$data.value) === null || _state$value$data$val === void 0 ? void 0 : _state$value$data$val.launcherUrl, "/instances/".concat(controller.nftId, "/renewal?locale=").concat(locale, "&return-url=").concat(encodeURIComponent(window.location.href))),
45
+ children: t('common.renew')
46
+ })]
47
+ });
48
+ }
49
+ Expiration.propTypes = {
50
+ controller: _propTypes.default.object.isRequired
51
+ };
52
+ var _default = Expiration;
53
+ exports.default = _default;
@@ -25,6 +25,7 @@ var _status = _interopRequireDefault(require("./status"));
25
25
  var _version = _interopRequireDefault(require("./version"));
26
26
  var _domainStatus = _interopRequireDefault(require("./router/domain-status"));
27
27
  var _types = require("./types");
28
+ var _expiration = _interopRequireDefault(require("./component/expiration"));
28
29
  var _jsxRuntime = require("react/jsx-runtime");
29
30
  var _templateObject, _templateObject2;
30
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -100,7 +101,8 @@ const getEngineRows = (engine, t) => {
100
101
  function BlockletOverview() {
101
102
  var _blocklet$settings;
102
103
  const {
103
- t
104
+ t,
105
+ locale
104
106
  } = (0, _context.useLocaleContext)();
105
107
  const {
106
108
  info: nodeInfo,
@@ -141,7 +143,13 @@ function BlockletOverview() {
141
143
  }, {
142
144
  name: t('common.author'),
143
145
  value: (0, _util2.formatPerson)(blocklet.meta.author)
144
- }, {
146
+ }, blocklet.controller ? {
147
+ name: t('common.expires'),
148
+ value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_expiration.default, {
149
+ controller: blocklet.controller,
150
+ locale: locale
151
+ })
152
+ } : null, {
145
153
  name: t('blocklet.installedAt'),
146
154
  value: (0, _util2.formatToDatetime)(blocklet.installedAt)
147
155
  }, blocklet.status === 'running' ? {
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Storage;
7
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
8
+ var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
9
+ var _react = require("react");
10
+ var _context = require("@arcblock/ux/lib/Locale/context");
11
+ var _constant = require("@blocklet/constant");
12
+ var _axios = _interopRequireDefault(require("axios"));
13
+ var _urlJoin = _interopRequireDefault(require("url-join"));
14
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
15
+ var _lodash = require("lodash");
16
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
17
+ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
18
+ var _material = require("@mui/material");
19
+ var _blocklet = require("../../lib/contexts/blocklet");
20
+ var _node = require("../contexts/node");
21
+ var _toast = _interopRequireDefault(require("../../lib/toast"));
22
+ var _jsxRuntime = require("react/jsx-runtime");
23
+ var _templateObject, _templateObject2;
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
30
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
31
+ function Storage() {
32
+ var _blocklet$environment;
33
+ /** @type {{ api: import('@abtnode/client').ABTNodeClient }} */
34
+ const {
35
+ api
36
+ } = (0, _node.useNodeContext)();
37
+ const {
38
+ t,
39
+ locale
40
+ } = (0, _react.useContext)(_context.LocaleContext);
41
+ const [errorMessage, setErrorMessage] = (0, _react.useState)(false);
42
+ /** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
43
+ const {
44
+ blocklet
45
+ } = (0, _blocklet.useBlockletContext)();
46
+ const [endpoint, setEndpoint] = (0, _react.useState)(((_blocklet$environment = blocklet.environments.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)) === null || _blocklet$environment === void 0 ? void 0 : _blocklet$environment.value) || '');
47
+ const [didSpacesUrl, setDidSpacesUrl] = (0, _react.useState)('https://storage.staging.abtnet.io/app');
48
+ const [isLoading, setIsLoading] = (0, _react.useState)(false);
49
+ const {
50
+ appDid
51
+ } = blocklet;
52
+ const {
53
+ title: appName,
54
+ description: appDescription
55
+ } = blocklet.meta;
56
+
57
+ /**
58
+ *
59
+ * @param {string} did
60
+ * @param {string} storageEndpoint
61
+ */
62
+ async function saveStorageEndpoint(did, storageEndpoint) {
63
+ await api.configBlocklet({
64
+ input: {
65
+ did: [did],
66
+ configs: [{
67
+ key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,
68
+ value: didSpacesUrl
69
+ }, {
70
+ key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,
71
+ value: storageEndpoint
72
+ }]
73
+ }
74
+ }).then(() => {
75
+ _toast.default.success(t('storage.didSpaces.getSpacesAuthorizeSuccessfully', locale));
76
+ }).catch(error => {
77
+ console.error(error);
78
+ _toast.default.error(error.message);
79
+ });
80
+ }
81
+ const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
82
+ open: false,
83
+ action: 'one-click-authorization',
84
+ checkTimeout: 1000 * 300,
85
+ checkFn: _axios.default.create({
86
+ baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
87
+ }).get,
88
+ /**
89
+ *
90
+ * @param {{endpoint: string}} response
91
+ */
92
+ onSuccess: async (response, decrypt) => {
93
+ setEndpoint(decrypt(response.endpoint));
94
+ await saveStorageEndpoint(blocklet.meta.did, decrypt(response.endpoint));
95
+ setTimeout(() => {
96
+ setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
97
+ open: false
98
+ }));
99
+ }, 3000);
100
+ },
101
+ onClose: () => {
102
+ setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
103
+ open: false
104
+ }));
105
+ }
106
+ });
107
+ const handleOnClickAuthorize = async () => {
108
+ if ((0, _lodash.isEmpty)(didSpacesUrl)) {
109
+ _toast.default.error(t('storage.didSpaces.addressCannotEmpty', locale));
110
+ return;
111
+ }
112
+ setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
113
+ prefix: (0, _urlJoin.default)(didSpacesUrl, 'space/api/did'),
114
+ baseUrl: new URL(didSpacesUrl).origin,
115
+ checkFn: _axios.default.create({
116
+ baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
117
+ }).get,
118
+ extraParams: {
119
+ appDid,
120
+ appName,
121
+ appDescription,
122
+ scopes: 'list:object read:object write:object'
123
+ },
124
+ open: true
125
+ }));
126
+ };
127
+ const onDidSpacesUrlChange = event => {
128
+ const {
129
+ value
130
+ } = event.target;
131
+ if ((0, _lodash.isEmpty)(value)) {
132
+ setErrorMessage(t('storage.didSpaces.addressCannotEmpty', locale));
133
+ } else {
134
+ setErrorMessage(null);
135
+ }
136
+ setDidSpacesUrl(value);
137
+ };
138
+ const onBackup = async () => {
139
+ try {
140
+ if (isLoading) {
141
+ return;
142
+ }
143
+ setIsLoading(true);
144
+ await api.backupToSpaces({
145
+ input: {
146
+ did: blocklet.appDid
147
+ }
148
+ });
149
+ _toast.default.success(t('storage.didSpaces.backupSuccessfully'));
150
+ } catch (error) {
151
+ _toast.default.error(error.message);
152
+ console.error(error);
153
+ } finally {
154
+ setIsLoading(false);
155
+ }
156
+ };
157
+ (0, _react.useEffect)(() => {
158
+ setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
159
+ messages: {
160
+ title: t('storage.didSpaces.authorize.title', {
161
+ appName
162
+ }),
163
+ scan: t('storage.didSpaces.authorize.scan', {
164
+ appName
165
+ }),
166
+ confirm: '',
167
+ success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
168
+ gutterBottom: true,
169
+ children: t('storage.didSpaces.authorize.success')
170
+ })
171
+ }
172
+ }));
173
+ }, [appName, locale, t]);
174
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
175
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StorageUrlTextField, {
176
+ sx: {
177
+ marginTop: '20px'
178
+ },
179
+ label: t('storage.didSpaces.label'),
180
+ value: didSpacesUrl,
181
+ onChange: onDidSpacesUrlChange,
182
+ autoFocus: true,
183
+ size: "small",
184
+ error: !!errorMessage,
185
+ helperText: errorMessage,
186
+ InputProps: {
187
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
188
+ variant: "contained",
189
+ onClick: handleOnClickAuthorize,
190
+ size: "small",
191
+ sx: {
192
+ position: 'absolute',
193
+ right: 0,
194
+ display: 'flex',
195
+ justifyContent: 'center',
196
+ alignItems: 'center',
197
+ width: '140px',
198
+ height: '100%'
199
+ },
200
+ children: endpoint ? t('storage.didSpaces.reAuthorization') : t('storage.didSpaces.goToAuthorization')
201
+ })
202
+ }
203
+ }), endpoint && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
204
+ color: "text.secondary",
205
+ sx: {
206
+ marginTop: '20px'
207
+ },
208
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
209
+ display: "flex",
210
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
211
+ display: "inline",
212
+ children: [t('storage.didSpaces.tips'), ": \xA0", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
213
+ display: "inline",
214
+ color: "primary.main",
215
+ fontWeight: "fontWeightBold",
216
+ children: t('storage.didSpaces.getSpacesAuthorizeSuccessfully')
217
+ })]
218
+ })
219
+ })
220
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
221
+ display: "flex",
222
+ justifyContent: "center",
223
+ sx: {
224
+ maxWidth: '580px',
225
+ marginTop: '20px',
226
+ padding: '0px 0px'
227
+ },
228
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
229
+ onClick: onBackup,
230
+ loading: isLoading,
231
+ variant: "contained",
232
+ color: "primary",
233
+ "data-cy": "add-domain-alias",
234
+ disabled: !endpoint || isLoading,
235
+ children: t('storage.didSpaces.backup')
236
+ })
237
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
238
+ prefix: authorizeConnect.prefix,
239
+ open: authorizeConnect.open,
240
+ popup: true,
241
+ action: authorizeConnect.action,
242
+ baseUrl: authorizeConnect.baseUrl,
243
+ checkFn: authorizeConnect.checkFn,
244
+ onSuccess: authorizeConnect.onSuccess,
245
+ onClose: authorizeConnect.onClose,
246
+ checkTimeout: authorizeConnect.checkTimeout,
247
+ extraParams: authorizeConnect.extraParams,
248
+ messages: authorizeConnect.messages,
249
+ locale: locale
250
+ })]
251
+ });
252
+ }
253
+ const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
254
+ const StorageUrlTextField = (0, _styled.default)(_material.TextField)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 56px;\n width: 580px;\n ", " {\n width: 75%;\n }\n input.MuiInputBase-input {\n width: calc(100% - 144px);\n }\n"])), props => props.theme.breakpoints.down('md'));
255
+ Storage.propTypes = {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
9
+ var _context = require("@arcblock/ux/lib/Locale/context");
10
+ var _Button = _interopRequireDefault(require("@arcblock/did-connect/lib/Button"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ var _templateObject;
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
15
+ function InvitationLogin(_ref) {
16
+ let {
17
+ onLogin
18
+ } = _ref;
19
+ const {
20
+ t
21
+ } = (0, _context.useLocaleContext)();
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
23
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
24
+ size: "large",
25
+ variant: "contained",
26
+ className: "invite-receive__button",
27
+ "data-cy": "invite-receive-passport",
28
+ color: "primary",
29
+ onClick: () => onLogin(),
30
+ children: t('common.connect')
31
+ })
32
+ });
33
+ }
34
+ InvitationLogin.propTypes = {
35
+ onLogin: _propTypes.default.func
36
+ };
37
+ InvitationLogin.defaultProps = {
38
+ onLogin: () => {}
39
+ };
40
+ const Root = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: center;\n .invite-receive__logo-wrapper {\n display: inline-flex;\n align-items: center;\n color: #9397a1;\n font-size: 14px;\n }\n .invite-receive__logo {\n height: 16px;\n margin-left: 8px;\n }\n .invite-receive__button {\n width: 100%;\n margin: 16px 0;\n white-space: nowrap;\n }\n .invite-receive__until {\n text-align: center;\n font-size: 14px;\n }\n .invite-receive__description {\n color: #999;\n text-align: left;\n list-style: decimal;\n padding: 0;\n padding-left: 1.2em;\n margin: 40px 0;\n }\n .invite-receive__description-item {\n list-style: decimal;\n }\n .invite-receive__link {\n color: ", ";\n }\n"])), _ref2 => {
41
+ let {
42
+ theme
43
+ } = _ref2;
44
+ return theme.palette.primary.main;
45
+ });
46
+ var _default = InvitationLogin;
47
+ exports.default = _default;
@@ -21,7 +21,7 @@ function InvitationReceive(_ref) {
21
21
  let {
22
22
  invitation,
23
23
  checkFn,
24
- onLoginSuccess,
24
+ onLogin,
25
25
  onReceive
26
26
  } = _ref;
27
27
  const [open, setOpen] = (0, _react.useState)(false);
@@ -39,10 +39,10 @@ function InvitationReceive(_ref) {
39
39
  const onClose = (0, _react.useCallback)(() => {
40
40
  setOpen(false);
41
41
  }, []);
42
- const onLogin = (0, _react.useCallback)(function () {
42
+ const onSuccess = (0, _react.useCallback)(function () {
43
43
  setOpen(false);
44
- onLoginSuccess(...arguments);
45
- }, [onLoginSuccess]);
44
+ onLogin(...arguments);
45
+ }, [onLogin]);
46
46
  const onClickReceive = (0, _react.useCallback)(() => {
47
47
  if (typeof onReceive === 'function') {
48
48
  onReceive();
@@ -72,7 +72,7 @@ function InvitationReceive(_ref) {
72
72
  action: "invite",
73
73
  checkFn: checkFn,
74
74
  checkTimeout: 10 * 60 * 1000,
75
- onSuccess: onLogin,
75
+ onSuccess: onSuccess,
76
76
  onClose: onClose,
77
77
  locale: locale,
78
78
  webWalletUrl: (0, _utils.getWebWalletUrl)(),
@@ -89,11 +89,11 @@ function InvitationReceive(_ref) {
89
89
  InvitationReceive.propTypes = {
90
90
  invitation: _propTypes.default.object.isRequired,
91
91
  checkFn: _propTypes.default.func.isRequired,
92
- onLoginSuccess: _propTypes.default.func,
92
+ onLogin: _propTypes.default.func,
93
93
  onReceive: _propTypes.default.func
94
94
  };
95
95
  InvitationReceive.defaultProps = {
96
- onLoginSuccess: () => {},
96
+ onLogin: () => {},
97
97
  onReceive: null
98
98
  };
99
99
  const Root = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: center;\n .invite-receive__logo-wrapper {\n display: inline-flex;\n align-items: center;\n color: #9397a1;\n font-size: 14px;\n }\n .invite-receive__logo {\n height: 16px;\n margin-left: 8px;\n }\n .invite-receive__button {\n width: 100%;\n margin: 16px 0;\n white-space: nowrap;\n }\n .invite-receive__until {\n text-align: center;\n font-size: 14px;\n }\n .invite-receive__description {\n color: #999;\n text-align: left;\n list-style: decimal;\n padding: 0;\n padding-left: 1.2em;\n margin: 40px 0;\n }\n .invite-receive__description-item {\n list-style: decimal;\n }\n .invite-receive__link {\n color: ", ";\n }\n"])), _ref2 => {
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _styled = _interopRequireDefault(require("@emotion/styled"));
10
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
12
+ var _CheckCircle = _interopRequireDefault(require("@mui/icons-material/CheckCircle"));
13
+ var _util = require("../util");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ var _templateObject;
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
18
+ function InvitationSuccess(_ref) {
19
+ let {
20
+ invitation,
21
+ type
22
+ } = _ref;
23
+ const {
24
+ t
25
+ } = (0, _context.useLocaleContext)();
26
+ const message = (0, _react.useMemo)(() => {
27
+ return t('invite.success', {
28
+ dapp: '{{dapp}}'
29
+ });
30
+ }, [t]);
31
+ const accountLink = (0, _util.getExplorerLink)(invitation.info.chainHost, invitation.inviter.did, 'account');
32
+ const user = type === 'receiver' ? invitation.receiver : invitation.inviter;
33
+ const messageList = (0, _util.patchJsxToLocale)(message, {
34
+ name() {
35
+ return accountLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
36
+ target: "_blank",
37
+ href: accountLink,
38
+ className: "invite-user__link",
39
+ rel: "noreferrer",
40
+ children: user.fullName
41
+ }, "name") : user.fullName;
42
+ },
43
+ dapp() {
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
45
+ target: "_blank",
46
+ href: invitation.info.url,
47
+ className: "invite-user__link",
48
+ rel: "noreferrer",
49
+ children: invitation.info.name
50
+ }, "dapp");
51
+ }
52
+ });
53
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, {
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
55
+ pt: 1,
56
+ color: "success.main",
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
58
+ style: {
59
+ fontSize: 80
60
+ }
61
+ })
62
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
63
+ className: "invite-user__message",
64
+ children: messageList
65
+ })]
66
+ });
67
+ }
68
+ InvitationSuccess.propTypes = {
69
+ invitation: _propTypes.default.object.isRequired,
70
+ type: _propTypes.default.oneOf('inviter', 'receiver')
71
+ };
72
+ InvitationSuccess.defaultProps = {
73
+ type: 'inviter'
74
+ };
75
+ const Root = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n .invite-user__name {\n font-weight: 700;\n font-size: 16px;\n margin: 8px 0 2px 0;\n }\n .invite-user__address {\n font-size: 12px;\n }\n .invite-user__message {\n margin-top: 20px;\n font-weight: 700;\n /* width: 90%; */\n text-align: center;\n font-size: 18px;\n }\n .invite-user__link {\n color: ", ";\n }\n"])), _ref2 => {
76
+ let {
77
+ theme
78
+ } = _ref2;
79
+ return theme.palette.primary.main;
80
+ });
81
+ var _default = InvitationSuccess;
82
+ exports.default = _default;
@@ -11,7 +11,9 @@ var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
11
11
  var _Result = _interopRequireDefault(require("@arcblock/ux/lib/Result"));
12
12
  var _invitationPassport = _interopRequireDefault(require("./invitation-passport"));
13
13
  var _invitationReceive = _interopRequireDefault(require("./invitation-receive"));
14
+ var _invitationLogin = _interopRequireDefault(require("./invitation-login"));
14
15
  var _invitationUser = _interopRequireDefault(require("./invitation-user"));
16
+ var _invitationSuccess = _interopRequireDefault(require("./invitation-success"));
15
17
  var _invitationApp = _interopRequireDefault(require("./invitation-app"));
16
18
  var _wrapLocale = _interopRequireDefault(require("../wrap-locale"));
17
19
  var _jsxRuntime = require("react/jsx-runtime");
@@ -38,20 +40,23 @@ function Invitation(_ref) {
38
40
  description: ""
39
41
  });
40
42
  }
43
+ const isSuccess = state.data.status === 'success';
44
+ const Section1 = isSuccess ? _invitationSuccess.default : _invitationUser.default;
45
+ const Section2 = isSuccess ? _invitationLogin.default : _invitationReceive.default;
41
46
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, {
42
47
  className: "page-invite__wrapper",
43
48
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_invitationApp.default, {
44
49
  invitation: state.data
45
50
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
46
51
  className: "page-invite__card",
47
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_invitationUser.default, {
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Section1, {
48
53
  invitation: state.data
49
54
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_invitationPassport.default, {
50
55
  invitation: state.data,
51
56
  passportColor: passportColor
52
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_invitationReceive.default, {
57
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Section2, {
53
58
  invitation: state.data,
54
- onLoginSuccess: onLoginSuccess,
59
+ onLogin: onLoginSuccess,
55
60
  checkFn: checkFn,
56
61
  onReceive: onReceive
57
62
  })]
package/lib/locales/en.js CHANGED
@@ -62,24 +62,17 @@ module.exports = {
62
62
  common: {
63
63
  about: 'About',
64
64
  access: 'Access',
65
- general: 'General',
66
- preferences: 'Preferences',
67
- auditLogs: 'Audit Trail',
68
- logs: 'Logs',
69
- filter: 'Log Filter',
70
- category: 'Log Topic',
71
- timeAgo: '{time} ago',
72
- afterTime: 'After {time}',
73
- abtnode: 'Blocklet Server',
74
65
  accessKey: 'Access Keys',
75
66
  action: 'Action',
76
67
  actions: 'Actions',
77
68
  add: 'Add',
78
69
  address: 'Address',
70
+ afterTime: 'After {time}',
79
71
  allow: 'Allow',
80
72
  alreadyExist: 'already exists',
81
73
  approve: 'Approve',
82
74
  approved: 'approved',
75
+ auditLogs: 'Audit Trail',
83
76
  author: 'Author',
84
77
  avatar: 'Avatar',
85
78
  back: 'Back',
@@ -92,6 +85,7 @@ module.exports = {
92
85
  cacheStorage: 'Cache Storage',
93
86
  cancel: 'Cancel',
94
87
  certificate: 'certificate',
88
+ category: 'Log Topic',
95
89
  click: 'Click to copy',
96
90
  close: 'Close',
97
91
  collapseAll: 'Collapse All',
@@ -104,6 +98,7 @@ module.exports = {
104
98
  configNavigation: 'Navigation',
105
99
  configSuccess: 'Config successfully',
106
100
  confirm: 'Confirm',
101
+ connect: 'Connect',
107
102
  console: 'Console',
108
103
  continueWith: 'Continue With',
109
104
  copiedTip: 'Copied',
@@ -145,10 +140,12 @@ module.exports = {
145
140
  export: 'Export',
146
141
  externalIp: 'External IP',
147
142
  failed: 'failed',
143
+ filter: 'Log Filter',
148
144
  fingerprint: 'Fingerprint',
149
145
  finish: 'Finish',
150
146
  forbid: 'Forbid',
151
147
  free: 'Free',
148
+ general: 'General',
152
149
  gitpod: 'IS Gitpod',
153
150
  goEULA: 'Click to view "End User License Agreement"',
154
151
  group: 'Group',
@@ -177,6 +174,7 @@ module.exports = {
177
174
  login: 'Login',
178
175
  logo: 'Logo',
179
176
  logout: 'Logout',
177
+ logs: 'Logs',
180
178
  manageTeam: 'Manage Team',
181
179
  marketplace: 'Marketplace',
182
180
  member: 'Member',
@@ -202,6 +200,7 @@ module.exports = {
202
200
  permission: 'Permission',
203
201
  port: 'Port',
204
202
  pre: 'Previous',
203
+ preferences: 'Preferences',
205
204
  protected: 'Protected',
206
205
  protocol: 'Protocol',
207
206
  published: 'published',
@@ -215,6 +214,7 @@ module.exports = {
215
214
  reload: 'Reload',
216
215
  remark: 'Remark',
217
216
  remove: 'Remove',
217
+ renew: 'Renew',
218
218
  reportIssue: 'Report an issue',
219
219
  requiredErrorText: '{name} is required',
220
220
  resource: 'Resource',
@@ -243,6 +243,7 @@ module.exports = {
243
243
  support: 'Support',
244
244
  team: 'Team',
245
245
  the: 'The',
246
+ timeAgo: '{time} ago',
246
247
  title: 'Title',
247
248
  type: 'Type',
248
249
  unavailable: 'Unavailable',
@@ -279,6 +280,13 @@ module.exports = {
279
280
  installFromMarket: 'Install New Blocklets',
280
281
  installFromUrl: 'Install From Url',
281
282
  installFromCreate: 'Create Blocklet',
283
+ restoreFromSpaces: 'Restore from Spaces',
284
+ restoreFromSpacesForm: {
285
+ endpoint: 'Spaces endpoint',
286
+ blockletSecretKey: "blocklet's secret key",
287
+ restore: 'Restore',
288
+ successfully: 'Restored successfully'
289
+ },
282
290
  installedAt: 'Installed At',
283
291
  internal: 'Internal',
284
292
  startedAt: 'Started At',
@@ -517,7 +525,6 @@ module.exports = {
517
525
  routingEngine: 'Routing Engine',
518
526
  ownerNftURL: 'Owner NFT',
519
527
  expirationLeft: 'Expiration Left',
520
- renew: 'Renew',
521
528
  startFromCrashTip: 'Blocklet Server did not exit normally last time, please manually start the blocklets that needs to be run.'
522
529
  },
523
530
  store: {
@@ -1115,6 +1122,7 @@ module.exports = {
1115
1122
  },
1116
1123
  invite: {
1117
1124
  message: '{name} invite you to be the {role} of {dapp}',
1125
+ success: 'You have successfully joined {dapp}',
1118
1126
  receive: 'Receive with',
1119
1127
  validUntil: 'Valid until:',
1120
1128
  viewPermission: 'View Permission',
@@ -1174,6 +1182,24 @@ module.exports = {
1174
1182
  noDel: 'Not allowed delete built-in navigation'
1175
1183
  }
1176
1184
  },
1185
+ storage: {
1186
+ didSpaces: {
1187
+ tips: 'Tips',
1188
+ label: 'Please enter DID Spaces service address',
1189
+ getSpacesAuthorizeSuccessfully: 'You have successfully obtained a Spaces license',
1190
+ goToAuthorization: 'Go to Authorization',
1191
+ reAuthorization: 'Re-authorization',
1192
+ authorize: {
1193
+ title: 'Authorize {appName}',
1194
+ scan: 'Use your DID Wallet to scan the QR code below to authorize the app {appName} to access the space in spaces',
1195
+ success: 'Authorized successfully'
1196
+ },
1197
+ backup: 'Backup',
1198
+ backupSuccessfully: 'Backup successfully',
1199
+ restore: 'Restore',
1200
+ restoreSuccessfully: 'Restore successfully'
1201
+ }
1202
+ },
1177
1203
  log: {
1178
1204
  lastDays: {
1179
1205
  1: 'Last 1 Day',
package/lib/locales/zh.js CHANGED
@@ -66,24 +66,17 @@ module.exports = {
66
66
  common: {
67
67
  about: '关于',
68
68
  access: '访问',
69
- general: '通用',
70
- preferences: '偏好',
71
- auditLogs: '审计记录',
72
- logs: '日志',
73
- filter: '筛选',
74
- category: '日志分类',
75
- timeAgo: '{time}前',
76
- afterTime: '{time}后',
77
- abtnode: '节点',
78
69
  accessKey: '访问秘钥',
79
70
  action: '操作',
80
71
  actions: '操作',
81
72
  add: '添加',
82
73
  address: '地址',
74
+ afterTime: '{time}后',
83
75
  allow: '允许',
84
76
  alreadyExist: '已经存在',
85
77
  approve: '同意',
86
78
  approved: 'Approved',
79
+ auditLogs: '审计记录',
87
80
  author: '作者',
88
81
  avatar: '头像',
89
82
  back: '返回',
@@ -95,6 +88,7 @@ module.exports = {
95
88
  blockletsStorage: '基石程序存储',
96
89
  cacheStorage: '缓存存储',
97
90
  cancel: '取消',
91
+ category: '日志分类',
98
92
  certificate: '证书',
99
93
  click: '点击复制',
100
94
  close: '关闭',
@@ -108,6 +102,7 @@ module.exports = {
108
102
  configNavigation: '导航',
109
103
  configSuccess: '设置成功',
110
104
  confirm: '确认',
105
+ connect: '连接',
111
106
  console: '控制台',
112
107
  continueWith: '确认继续',
113
108
  copiedTip: '已复制',
@@ -151,10 +146,12 @@ module.exports = {
151
146
  export: '导出',
152
147
  externalIp: '公网 IP',
153
148
  failed: '失败',
149
+ filter: '筛选',
154
150
  fingerprint: '指纹',
155
151
  finish: '完成',
156
152
  forbid: '禁止',
157
153
  free: '免费',
154
+ general: '通用',
158
155
  gitpod: 'Gitpod?',
159
156
  goEULA: '点击查看"最终用户许可协议"',
160
157
  group: '分组',
@@ -183,6 +180,7 @@ module.exports = {
183
180
  login: '登录',
184
181
  logo: '图标',
185
182
  logout: '退出',
183
+ logs: '日志',
186
184
  manageTeam: '管理团队',
187
185
  marketplace: '市场',
188
186
  member: '成员',
@@ -208,6 +206,7 @@ module.exports = {
208
206
  permission: '权限',
209
207
  port: '端口',
210
208
  pre: '上一步',
209
+ preferences: '偏好',
211
210
  protected: '受保护',
212
211
  protocol: '协议',
213
212
  published: '发布于',
@@ -221,6 +220,7 @@ module.exports = {
221
220
  reload: '优雅重启',
222
221
  remark: '备注',
223
222
  remove: '删除',
223
+ renew: '续期',
224
224
  reportIssue: '问题反馈',
225
225
  requiredErrorText: '{name}是必填的',
226
226
  resource: '资源',
@@ -249,6 +249,7 @@ module.exports = {
249
249
  support: '服务支持',
250
250
  team: '团队',
251
251
  the: '此',
252
+ timeAgo: '{time}前',
252
253
  title: '名称',
253
254
  type: '类型',
254
255
  unavailable: '不可访问',
@@ -285,6 +286,13 @@ module.exports = {
285
286
  installFromMarket: '从应用商店安装',
286
287
  installFromUrl: '通过 URL 安装',
287
288
  installFromCreate: '创建基石程序',
289
+ restoreFromSpaces: '从 Spaces 还原',
290
+ restoreFromSpacesForm: {
291
+ endpoint: 'Spaces 端点',
292
+ blockletSecretKey: 'blocklet 的私钥',
293
+ restore: '还原',
294
+ successfully: '还原成功'
295
+ },
288
296
  installedAt: '安装时间',
289
297
  internal: '内部',
290
298
  startedAt: '启动时间',
@@ -525,7 +533,6 @@ module.exports = {
525
533
  routingEngine: '路由引擎',
526
534
  ownerNftURL: '所有者 NFT',
527
535
  expirationLeft: '有效期还剩',
528
- renew: '续期',
529
536
  startFromCrashTip: 'Blocklet Server 上次未正常退出,请手动启动需要运行的 blocklet.'
530
537
  },
531
538
  store: {
@@ -1120,6 +1127,7 @@ module.exports = {
1120
1127
  },
1121
1128
  invite: {
1122
1129
  message: '{name} 邀请你成为 {dapp} 的 {role}',
1130
+ success: '你已成功加入 {dapp}',
1123
1131
  receive: '领取通行证',
1124
1132
  validUntil: '过期时间:',
1125
1133
  viewPermission: '查看权限',
@@ -1179,6 +1187,25 @@ module.exports = {
1179
1187
  noDel: '内置的导航无法删除'
1180
1188
  }
1181
1189
  },
1190
+ storage: {
1191
+ didSpaces: {
1192
+ tips: '提示',
1193
+ label: '请输入 DID Spaces 服务地址',
1194
+ getSpacesAuthorizeSuccessfully: '你已成功获得 Spaces 授权',
1195
+ goToAuthorization: '前往授权',
1196
+ reAuthorization: '重新授权',
1197
+ addressCannotEmpty: '地址不能为空',
1198
+ authorize: {
1199
+ title: '授权 {appName}',
1200
+ scan: '使用你的 DID Wallet 扫描下面的二维码以授权应用 {appName} 访问 Spaces 中的空间',
1201
+ success: '授权成功'
1202
+ },
1203
+ backup: '备份',
1204
+ backupSuccessfully: '备份成功',
1205
+ restore: '还原',
1206
+ restoreSuccessfully: '还原成功'
1207
+ }
1208
+ },
1182
1209
  log: {
1183
1210
  lastDays: {
1184
1211
  1: '最近 1 天',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.63",
6
+ "version": "1.8.64-beta-0b5ede51",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,19 +21,19 @@
21
21
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@abtnode/auth": "1.8.63",
25
- "@abtnode/constant": "1.8.63",
26
- "@abtnode/util": "1.8.63",
27
- "@arcblock/did-connect": "^2.4.65",
24
+ "@abtnode/auth": "1.8.64-beta-0b5ede51",
25
+ "@abtnode/constant": "1.8.64-beta-0b5ede51",
26
+ "@abtnode/util": "1.8.64-beta-0b5ede51",
27
+ "@arcblock/did-connect": "^2.4.66",
28
28
  "@arcblock/did-motif": "^1.1.10",
29
- "@arcblock/icons": "^2.4.65",
30
- "@arcblock/terminal": "^2.4.65",
31
- "@arcblock/ux": "^2.4.65",
32
- "@blocklet/constant": "1.8.63",
33
- "@blocklet/launcher-layout": "^1.9.38",
29
+ "@arcblock/icons": "^2.4.66",
30
+ "@arcblock/terminal": "^2.4.66",
31
+ "@arcblock/ux": "^2.4.66",
32
+ "@blocklet/constant": "1.8.64-beta-0b5ede51",
33
+ "@blocklet/launcher-layout": "^1.9.50",
34
34
  "@blocklet/list": "^0.10.47",
35
- "@blocklet/meta": "1.8.63",
36
- "@blocklet/ui-react": "^2.4.65",
35
+ "@blocklet/meta": "1.8.64-beta-0b5ede51",
36
+ "@blocklet/ui-react": "^2.4.66",
37
37
  "@emotion/react": "^11.10.4",
38
38
  "@emotion/styled": "^11.10.4",
39
39
  "@iconify/react": "^4.0.0",
@@ -86,5 +86,5 @@
86
86
  "@babel/preset-react": "^7.18.6",
87
87
  "babel-plugin-inline-react-svg": "^1.1.2"
88
88
  },
89
- "gitHead": "69c7bf7f79fbabc8718d8ec0c6fb36ce9477cfd8"
89
+ "gitHead": "fbb72fdf88ea44c949ea951b84ab0506805bda7d"
90
90
  }