@abtnode/ux 1.16.26-beta-5251ab18 → 1.16.26-beta-351de484

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 (87) hide show
  1. package/es/blocklet/{oauth → authentication/federated}/federated-detail-dialog.js +2 -2
  2. package/es/blocklet/{oauth → authentication/federated}/federated-join-dialog.js +2 -2
  3. package/es/blocklet/{oauth → authentication/federated}/federated-site-list.js +3 -3
  4. package/es/blocklet/{oauth/federated.js → authentication/federated/index.js} +1 -1
  5. package/es/blocklet/{oauth → authentication}/index.js +7 -5
  6. package/es/blocklet/authentication/oauth/apple.js +198 -0
  7. package/es/blocklet/{oauth → authentication/oauth}/auth0.js +27 -7
  8. package/es/blocklet/authentication/oauth/drag-item.js +177 -0
  9. package/es/blocklet/authentication/oauth/github.js +145 -0
  10. package/es/blocklet/authentication/oauth/google.js +144 -0
  11. package/es/blocklet/authentication/oauth/index.js +122 -0
  12. package/es/blocklet/preferences/index.js +6 -6
  13. package/es/blocklet/publish/connect-store-list.js +8 -6
  14. package/es/blocklet/publish/create-release.js +16 -7
  15. package/es/blocklet/publish/project-list.js +30 -3
  16. package/es/blocklet/storage/action.js +8 -4
  17. package/es/blocklet/storage/item.js +2 -1
  18. package/es/confirm.js +5 -2
  19. package/es/contexts/blocklet-storage.js +0 -4
  20. package/es/layout/feedback.js +7 -4
  21. package/es/locales/ar.js +34 -5
  22. package/es/locales/de.js +35 -6
  23. package/es/locales/en.js +34 -5
  24. package/es/locales/es.js +35 -6
  25. package/es/locales/fr.js +35 -6
  26. package/es/locales/hi.js +35 -6
  27. package/es/locales/i18n.db +0 -0
  28. package/es/locales/id.js +35 -6
  29. package/es/locales/ja.js +34 -5
  30. package/es/locales/ko.js +35 -6
  31. package/es/locales/pt.js +35 -6
  32. package/es/locales/ru.js +34 -5
  33. package/es/locales/th.js +34 -5
  34. package/es/locales/vi.js +34 -5
  35. package/es/locales/zh-tw.js +34 -5
  36. package/es/locales/zh.js +35 -6
  37. package/es/store/connect-actions.js +14 -5
  38. package/es/store/delete.js +7 -3
  39. package/es/store/item.js +99 -20
  40. package/es/team/members/index.js +16 -13
  41. package/es/team/members/member.js +2 -7
  42. package/lib/blocklet/{oauth → authentication/federated}/federated-detail-dialog.js +2 -2
  43. package/lib/blocklet/{oauth → authentication/federated}/federated-join-dialog.js +2 -2
  44. package/lib/blocklet/{oauth → authentication/federated}/federated-site-list.js +3 -3
  45. package/lib/blocklet/{oauth/federated.js → authentication/federated/index.js} +1 -1
  46. package/lib/blocklet/{oauth → authentication}/index.js +7 -5
  47. package/lib/blocklet/authentication/oauth/apple.js +226 -0
  48. package/lib/blocklet/authentication/oauth/auth0.js +189 -0
  49. package/lib/blocklet/authentication/oauth/drag-item.js +185 -0
  50. package/lib/blocklet/{oauth/auth0.js → authentication/oauth/github.js} +26 -25
  51. package/lib/blocklet/authentication/oauth/google.js +166 -0
  52. package/lib/blocklet/authentication/oauth/index.js +136 -0
  53. package/lib/blocklet/preferences/index.js +6 -6
  54. package/lib/blocklet/publish/connect-store-list.js +9 -8
  55. package/lib/blocklet/publish/create-release.js +16 -6
  56. package/lib/blocklet/publish/project-list.js +29 -2
  57. package/lib/blocklet/storage/action.js +10 -6
  58. package/lib/blocklet/storage/item.js +2 -1
  59. package/lib/confirm.js +7 -4
  60. package/lib/contexts/blocklet-storage.js +0 -4
  61. package/lib/layout/feedback.js +6 -3
  62. package/lib/locales/ar.js +34 -5
  63. package/lib/locales/de.js +35 -6
  64. package/lib/locales/en.js +34 -5
  65. package/lib/locales/es.js +35 -6
  66. package/lib/locales/fr.js +35 -6
  67. package/lib/locales/hi.js +35 -6
  68. package/lib/locales/i18n.db +0 -0
  69. package/lib/locales/id.js +35 -6
  70. package/lib/locales/ja.js +34 -5
  71. package/lib/locales/ko.js +35 -6
  72. package/lib/locales/pt.js +35 -6
  73. package/lib/locales/ru.js +34 -5
  74. package/lib/locales/th.js +34 -5
  75. package/lib/locales/vi.js +34 -5
  76. package/lib/locales/zh-tw.js +34 -5
  77. package/lib/locales/zh.js +35 -6
  78. package/lib/store/connect-actions.js +14 -5
  79. package/lib/store/delete.js +7 -3
  80. package/lib/store/item.js +111 -19
  81. package/lib/team/members/index.js +13 -11
  82. package/lib/team/members/member.js +1 -6
  83. package/package.json +32 -22
  84. /package/es/blocklet/{oauth → authentication}/common-settings.js +0 -0
  85. /package/es/blocklet/{oauth → authentication/federated}/federated-invite-dialog.js +0 -0
  86. /package/lib/blocklet/{oauth → authentication}/common-settings.js +0 -0
  87. /package/lib/blocklet/{oauth → authentication/federated}/federated-invite-dialog.js +0 -0
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ var _pick = _interopRequireDefault(require("lodash/pick"));
9
+ var _ahooks = require("ahooks");
10
+ var _reactHookForm = require("react-hook-form");
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
12
+ var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
13
+ var _node = require("../../../contexts/node");
14
+ var _blocklet = require("../../../contexts/blocklet");
15
+ var _switchControl = _interopRequireDefault(require("../../component/switch-control"));
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
+ 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; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ function OAuthGoogle() {
24
+ var _blocklet$meta, _blocklet$settings;
25
+ const {
26
+ api
27
+ } = (0, _node.useNodeContext)();
28
+ const {
29
+ blocklet
30
+ } = (0, _blocklet.useBlockletContext)();
31
+ const {
32
+ t
33
+ } = (0, _context.useLocaleContext)();
34
+ const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
35
+ const authData = Object.assign({
36
+ enabled: false,
37
+ clientId: '',
38
+ clientSecret: ''
39
+ }, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.google) || {});
40
+ const {
41
+ handleSubmit,
42
+ control,
43
+ formState,
44
+ watch,
45
+ reset
46
+ } = (0, _reactHookForm.useForm)({
47
+ defaultValues: (0, _pick.default)(authData, ['clientSecret', 'clientId', 'enabled'])
48
+ });
49
+ const enabled = watch('enabled');
50
+ const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
51
+ try {
52
+ var _blockletChanged$sett;
53
+ const {
54
+ blocklet: blockletChanged
55
+ } = await api.configOAuth({
56
+ input: {
57
+ did,
58
+ oauth: JSON.stringify({
59
+ google: data
60
+ })
61
+ }
62
+ });
63
+ const defaultValues = Object.assign({
64
+ enabled: false,
65
+ clientId: '',
66
+ clientSecret: ''
67
+ }, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.google) || {});
68
+ // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
69
+ reset(defaultValues);
70
+ _Toast.default.success(t('oauth.saveSuccess'));
71
+ } catch (err) {
72
+ _Toast.default.error(err.message || t('oauth.saveFailed'));
73
+ }
74
+ });
75
+ const validateClientId = (0, _ahooks.useMemoizedFn)(val => {
76
+ if (!(val !== null && val !== void 0 && val.trim())) {
77
+ return t('oauth.google.clientIdDescribe');
78
+ }
79
+ return true;
80
+ });
81
+ const validateClientSecret = (0, _ahooks.useMemoizedFn)(val => {
82
+ if (!(val !== null && val !== void 0 && val.trim())) {
83
+ return t('oauth.google.clientSecretDescribe');
84
+ }
85
+ return true;
86
+ });
87
+ const noop = (0, _ahooks.useMemoizedFn)(() => true);
88
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
89
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
90
+ onSubmit: handleSubmit(onSubmit),
91
+ disabled: true,
92
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
93
+ name: "enabled",
94
+ control: control,
95
+ render: _ref => {
96
+ let {
97
+ field
98
+ } = _ref;
99
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
100
+ control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_switchControl.default, _objectSpread({
101
+ checked: field.value,
102
+ style: {
103
+ marginRight: '6px'
104
+ }
105
+ }, field)),
106
+ label: t('oauth.google.enable'),
107
+ sx: {
108
+ marginBottom: 2,
109
+ ml: 1
110
+ }
111
+ });
112
+ }
113
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
114
+ name: "clientId",
115
+ control: control,
116
+ rules: {
117
+ validate: enabled ? validateClientId : noop
118
+ },
119
+ render: _ref2 => {
120
+ var _formState$errors$fie;
121
+ let {
122
+ field
123
+ } = _ref2;
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
125
+ fullWidth: true,
126
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
127
+ error: !!formState.errors[field.name],
128
+ label: t('oauth.google.clientId'),
129
+ helperText: ((_formState$errors$fie = formState.errors[field.name]) === null || _formState$errors$fie === void 0 ? void 0 : _formState$errors$fie.message) || ' ',
130
+ disabled: !enabled
131
+ }))
132
+ });
133
+ }
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
135
+ name: "clientSecret",
136
+ control: control,
137
+ rules: {
138
+ validate: enabled ? validateClientSecret : noop
139
+ },
140
+ render: _ref3 => {
141
+ var _formState$errors$fie2;
142
+ let {
143
+ field
144
+ } = _ref3;
145
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
146
+ fullWidth: true,
147
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
148
+ type: "password",
149
+ label: t('oauth.google.clientSecret'),
150
+ error: !!formState.errors[field.name],
151
+ helperText: ((_formState$errors$fie2 = formState.errors[field.name]) === null || _formState$errors$fie2 === void 0 ? void 0 : _formState$errors$fie2.message) || ' ',
152
+ disabled: !enabled
153
+ }))
154
+ });
155
+ }
156
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
157
+ type: "submit",
158
+ variant: "contained",
159
+ onSubmit: handleSubmit(onSubmit),
160
+ disabled: !formState.isDirty,
161
+ children: t('oauth.save')
162
+ })]
163
+ })
164
+ });
165
+ }
166
+ var _default = exports.default = OAuthGoogle;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = OAuthLogin;
7
+ var _material = require("@mui/material");
8
+ var _ahooks = require("ahooks");
9
+ var _reactDnd = require("react-dnd");
10
+ var _reactDndHtml5Backend = require("react-dnd-html5-backend");
11
+ var _react = require("@iconify/react");
12
+ var _apple = _interopRequireDefault(require("@iconify-icons/logos/apple"));
13
+ var _githubIcon = _interopRequireDefault(require("@iconify-icons/logos/github-icon"));
14
+ var _googleIcon = _interopRequireDefault(require("@iconify-icons/logos/google-icon"));
15
+ var _auth0Icon = _interopRequireDefault(require("@iconify-icons/logos/auth0-icon"));
16
+ var _auth = _interopRequireDefault(require("./auth0"));
17
+ var _github = _interopRequireDefault(require("./github"));
18
+ var _google = _interopRequireDefault(require("./google"));
19
+ var _apple2 = _interopRequireDefault(require("./apple"));
20
+ var _dragItem = _interopRequireDefault(require("./drag-item"));
21
+ var _node = require("../../../contexts/node");
22
+ var _blocklet = require("../../../contexts/blocklet");
23
+ var _jsxRuntime = require("react/jsx-runtime");
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
26
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
27
+ 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; }
28
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
29
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
30
+ const avaliableAuthentication = [{
31
+ name: 'github',
32
+ title: 'GitHub',
33
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
34
+ icon: _githubIcon.default
35
+ }),
36
+ component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_github.default, {})
37
+ }, {
38
+ name: 'google',
39
+ title: 'Google',
40
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
41
+ icon: _googleIcon.default
42
+ }),
43
+ component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_google.default, {})
44
+ }, {
45
+ name: 'apple',
46
+ title: 'Apple',
47
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
48
+ icon: _apple.default
49
+ }),
50
+ component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_apple2.default, {})
51
+ }, {
52
+ name: 'auth0',
53
+ title: 'Auth0',
54
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
55
+ icon: _auth0Icon.default
56
+ }),
57
+ component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_auth.default, {})
58
+ }];
59
+ const DEFAULT_OAUTH_LIST = ['github', 'google', 'apple', 'auth0'];
60
+ function OAuthLogin() {
61
+ var _blocklet$meta, _blocklet$settings;
62
+ const {
63
+ api
64
+ } = (0, _node.useNodeContext)();
65
+ const {
66
+ blocklet
67
+ } = (0, _blocklet.useBlockletContext)();
68
+ const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
69
+ const oauthConfig = (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.oauth) || {};
70
+ const oauthSort = Object.keys(oauthConfig).sort((a, b) => {
71
+ var _oauthConfig$a, _oauthConfig$b, _oauthConfig$a2;
72
+ if (((_oauthConfig$a = oauthConfig[a]) === null || _oauthConfig$a === void 0 ? void 0 : _oauthConfig$a.order) !== undefined && ((_oauthConfig$b = oauthConfig[b]) === null || _oauthConfig$b === void 0 ? void 0 : _oauthConfig$b.order) !== undefined) {
73
+ return oauthConfig[a].order - oauthConfig[b].order;
74
+ }
75
+ if (((_oauthConfig$a2 = oauthConfig[a]) === null || _oauthConfig$a2 === void 0 ? void 0 : _oauthConfig$a2.order) !== undefined) {
76
+ return -1;
77
+ }
78
+ return 1;
79
+ });
80
+ for (const OAUTH_ITEM of DEFAULT_OAUTH_LIST) {
81
+ if (!oauthSort.includes(OAUTH_ITEM)) {
82
+ oauthSort.push(OAUTH_ITEM);
83
+ }
84
+ }
85
+ const sortMaps = (0, _ahooks.useReactive)(oauthSort.reduce((total, value, index) => Object.assign(total, {
86
+ [value]: index
87
+ }), {}));
88
+ const sortedAuthentication = (0, _ahooks.useCreation)(() => {
89
+ const list = [...avaliableAuthentication];
90
+ list.sort((a, b) => sortMaps[a.name] - sortMaps[b.name]);
91
+ return list;
92
+ }, [sortMaps.auth0, sortMaps.github, sortMaps.google]);
93
+ const dndProps = {};
94
+ if (typeof window !== 'undefined') {
95
+ dndProps.context = window;
96
+ }
97
+ const saveOrder = (0, _ahooks.useMemoizedFn)(async rawOrderData => {
98
+ const orderData = {};
99
+ Object.keys(rawOrderData).forEach(oauthName => {
100
+ orderData[oauthName] = {
101
+ order: rawOrderData[oauthName]
102
+ };
103
+ });
104
+ await api.configOAuth({
105
+ input: {
106
+ did,
107
+ oauth: JSON.stringify(orderData)
108
+ }
109
+ });
110
+ });
111
+ const handleMoveItem = (0, _ahooks.useMemoizedFn)((dragIndex, hoverIndex) => {
112
+ const dragItem = sortedAuthentication[dragIndex];
113
+ const hoverItem = sortedAuthentication[hoverIndex];
114
+ sortMaps[dragItem.name] = hoverIndex;
115
+ sortMaps[hoverItem.name] = dragIndex;
116
+ });
117
+ const handleSaveOrder = (0, _ahooks.useMemoizedFn)(async () => {
118
+ await saveOrder(sortMaps);
119
+ });
120
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
121
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDnd.DndProvider, _objectSpread(_objectSpread({
122
+ backend: _reactDndHtml5Backend.HTML5Backend
123
+ }, dndProps), {}, {
124
+ children: sortedAuthentication.map((x, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dragItem.default, {
125
+ index: index,
126
+ id: x.name,
127
+ title: x.title,
128
+ icon: x.icon,
129
+ onMove: handleMoveItem,
130
+ onEnd: handleSaveOrder,
131
+ defaultExpand: x.enabled,
132
+ children: x.component
133
+ }, x.name))
134
+ }))
135
+ });
136
+ }
@@ -28,7 +28,7 @@ var _configuration = _interopRequireDefault(require("../configuration"));
28
28
  var _notification = _interopRequireDefault(require("../notification"));
29
29
  var _index = _interopRequireDefault(require("../access/index"));
30
30
  var _node = require("../../contexts/node");
31
- var _oauth = _interopRequireDefault(require("../oauth"));
31
+ var _authentication = _interopRequireDefault(require("../authentication"));
32
32
  var _jsxRuntime = require("react/jsx-runtime");
33
33
  var _templateObject;
34
34
  const _excluded = ["blocklet", "onUpdate"]; // eslint-disable-line
@@ -150,7 +150,7 @@ function BlockletPreferences(_ref2) {
150
150
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
151
151
  display: "flex",
152
152
  alignItems: "center",
153
- "data-cy": "configuration-tab-oauth",
153
+ "data-cy": "configuration-tab-authentication",
154
154
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Login.default, {
155
155
  sx: {
156
156
  fontSize: 24
@@ -164,8 +164,8 @@ function BlockletPreferences(_ref2) {
164
164
  children: t('common.login')
165
165
  })
166
166
  })]
167
- }, "oauth"),
168
- value: 'oauth'
167
+ }, "authentication"),
168
+ value: 'authentication'
169
169
  }, {
170
170
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
171
171
  display: "flex",
@@ -246,8 +246,8 @@ function BlockletPreferences(_ref2) {
246
246
  });
247
247
  } else if (current === 'access') {
248
248
  content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {});
249
- } else if (current === 'oauth') {
250
- content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_oauth.default, {});
249
+ } else if (current === 'authentication') {
250
+ content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_authentication.default, {});
251
251
  } else if (current === 'notification') {
252
252
  content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_notification.default, {});
253
253
  } else {
@@ -12,10 +12,11 @@ var _item = _interopRequireDefault(require("../../store/item"));
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function ConnectStoreList(_ref) {
15
- var _blocklet$settings, _blocklet$settings4, _blocklet$meta;
15
+ var _blocklet$settings, _blocklet$meta;
16
16
  let {
17
17
  blocklet,
18
18
  releaseId,
19
+ connectedStores,
19
20
  projectId,
20
21
  releaseType,
21
22
  publishedStoreIds,
@@ -24,15 +25,14 @@ function ConnectStoreList(_ref) {
24
25
  } = _ref;
25
26
  const storeList = (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.storeList) || [];
26
27
  const connectedMap = (0, _react.useMemo)(() => {
27
- var _blocklet$settings2, _blocklet$settings3;
28
- if (!(blocklet !== null && blocklet !== void 0 && (_blocklet$settings2 = blocklet.settings) !== null && _blocklet$settings2 !== void 0 && _blocklet$settings2.connectedStores)) {
28
+ if (!(connectedStores !== null && connectedStores !== void 0 && connectedStores.length)) {
29
29
  return {};
30
30
  }
31
- return blocklet === null || blocklet === void 0 || (_blocklet$settings3 = blocklet.settings) === null || _blocklet$settings3 === void 0 || (_blocklet$settings3 = _blocklet$settings3.connectedStores) === null || _blocklet$settings3 === void 0 ? void 0 : _blocklet$settings3.reduce((acc, x) => {
32
- acc[x.storeUrl] = x;
31
+ return connectedStores === null || connectedStores === void 0 ? void 0 : connectedStores.reduce((acc, x) => {
32
+ acc[x.storeId] = x;
33
33
  return acc;
34
34
  }, {});
35
- }, [blocklet === null || blocklet === void 0 || (_blocklet$settings4 = blocklet.settings) === null || _blocklet$settings4 === void 0 ? void 0 : _blocklet$settings4.connectedStores]);
35
+ }, [connectedStores]);
36
36
  const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
37
37
  const handleAddStore = () => {};
38
38
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
@@ -47,7 +47,7 @@ function ConnectStoreList(_ref) {
47
47
  teamDid: did,
48
48
  store: x,
49
49
  published: (publishedStoreIds === null || publishedStoreIds === void 0 ? void 0 : publishedStoreIds.indexOf(x.id)) > -1,
50
- connected: !!connectedMap[x.url],
50
+ connectedStore: connectedMap[x.id],
51
51
  onPublish: onPublish,
52
52
  onDelete: onDelete
53
53
  })
@@ -66,7 +66,8 @@ ConnectStoreList.propTypes = {
66
66
  releaseType: _propTypes.default.string.isRequired,
67
67
  onPublish: _propTypes.default.func,
68
68
  onDelete: _propTypes.default.func,
69
- publishedStoreIds: _propTypes.default.arrayOf(_propTypes.default.string)
69
+ publishedStoreIds: _propTypes.default.arrayOf(_propTypes.default.string),
70
+ connectedStores: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
70
71
  };
71
72
  ConnectStoreList.defaultProps = {
72
73
  publishedStoreIds: [],
@@ -126,9 +126,10 @@ const addComponentTabs = _ref => {
126
126
  });
127
127
  };
128
128
  const pickParams = (release, app) => {
129
- const params = (0, _pick.default)(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'publishedStoreIds', 'note']);
129
+ const params = (0, _pick.default)(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'publishedStoreIds', 'connectedStores', 'note']);
130
130
  params.blockletScreenshots || (params.blockletScreenshots = []);
131
131
  params.publishedStoreIds || (params.publishedStoreIds = []);
132
+ params.connectedStores || (params.connectedStores = []);
132
133
  if (!params.blockletComponents) {
133
134
  params.blockletComponents = (app.children || []).map(x => ({
134
135
  did: x.meta.did,
@@ -167,7 +168,10 @@ function CreateRelease(_ref2) {
167
168
  const [createLoading, setCreateLoading] = (0, _react.useState)(false);
168
169
  const [release, setRelease] = (0, _react.useState)(null);
169
170
  const {
170
- api
171
+ api,
172
+ ws: {
173
+ useSubscription
174
+ }
171
175
  } = (0, _node.useNodeContext)();
172
176
  const uploaderLogoRef = (0, _react.useRef)(null);
173
177
  const uploaderScreenshotRef = (0, _react.useRef)(null);
@@ -240,7 +244,7 @@ function CreateRelease(_ref2) {
240
244
  }
241
245
  }).then(res => {
242
246
  setLoading(false);
243
- setParams(pickParams(res === null || res === void 0 ? void 0 : res.release, blocklet));
247
+ // setParams(pickParams(res?.release, blocklet));
244
248
  setRelease(res === null || res === void 0 ? void 0 : res.release);
245
249
  }).catch(err => {
246
250
  setLoading(false);
@@ -255,9 +259,7 @@ function CreateRelease(_ref2) {
255
259
  }
256
260
  getRelease();
257
261
  }
258
- if (mode === 'create') {
259
- getProject();
260
- }
262
+ getProject();
261
263
  // eslint-disable-next-line react-hooks/exhaustive-deps
262
264
  }, [mode, releaseId]);
263
265
  const onRelease = status => {
@@ -389,6 +391,12 @@ function CreateRelease(_ref2) {
389
391
  (0, _react.useEffect)(() => {
390
392
  getData();
391
393
  }, [getData]);
394
+ useSubscription(_constant2.EVENTS.NOTIFICATION_BLOCKLET_CREATE, notification => {
395
+ var _notification$meta;
396
+ if ((notification === null || notification === void 0 || (_notification$meta = notification.meta) === null || _notification$meta === void 0 ? void 0 : _notification$meta.eventType) === _constant2.STUDIO_CONNECTED_STORE) {
397
+ getData();
398
+ }
399
+ }, [getData]);
392
400
  if (!params && loading) {
393
401
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_emptySpinner.default, {});
394
402
  }
@@ -972,6 +980,8 @@ function CreateRelease(_ref2) {
972
980
  projectId: projectId,
973
981
  releaseId: releaseId,
974
982
  onPublish: getRelease,
983
+ onDelete: getData,
984
+ connectedStores: params.connectedStores,
975
985
  publishedStoreIds: release === null || release === void 0 ? void 0 : release.publishedStoreIds
976
986
  })
977
987
  })]
@@ -15,6 +15,7 @@ var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
15
15
  var _FileOpen = _interopRequireDefault(require("@mui/icons-material/FileOpen"));
16
16
  var _AddBox = _interopRequireDefault(require("@mui/icons-material/AddBox"));
17
17
  var _HelpOutlineOutlined = _interopRequireDefault(require("@mui/icons-material/HelpOutlineOutlined"));
18
+ var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
18
19
  var _constant = require("@abtnode/constant");
19
20
  var _Datatable = _interopRequireDefault(require("@arcblock/ux/lib/Datatable"));
20
21
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
@@ -368,10 +369,36 @@ function ProjectList() {
368
369
  }
369
370
  }), deleteConfirm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
370
371
  title: "".concat(t('common.delete'), " ").concat(deleteConfirm.blockletTitle),
371
- description: t('blocklet.publish.deleteBlockletTip'),
372
+ description: t('blocklet.publish.deleteProject.description'),
372
373
  confirm: t('common.confirm'),
373
374
  onConfirm: confirmDeleteProject,
374
- onCancel: () => setDeleteConfirm(null)
375
+ onCancel: () => setDeleteConfirm(null),
376
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
377
+ sx: {
378
+ marginTop: 2
379
+ },
380
+ children: [t('blocklet.publish.deleteProject.tip1'), t('blocklet.publish.deleteProject.tip2'), t('blocklet.publish.deleteProject.tip3')].map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
381
+ sx: {
382
+ display: 'flex',
383
+ marginTop: 1,
384
+ flexDirection: 'row',
385
+ alignItems: 'flex-start'
386
+ },
387
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Error.default, {
388
+ color: "warning",
389
+ sx: {
390
+ marginRight: 1,
391
+ fontSize: 20,
392
+ marginTop: '2px'
393
+ }
394
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
395
+ component: "span",
396
+ variant: "inherit",
397
+ color: "text.secondary",
398
+ children: x
399
+ })]
400
+ }))
401
+ })
375
402
  }), didConnect]
376
403
  });
377
404
  }
@@ -16,7 +16,7 @@ var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
16
16
  var _spaces = require("../../util/spaces");
17
17
  var _delete = _interopRequireDefault(require("./delete"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- const _excluded = ["spaceGateway", "connected", "onDelete", "onConnect", "enableSwitchToSpace"];
19
+ const _excluded = ["spaceGateway", "connected", "onDelete", "onConnect", "enableSwitchToSpace", "backupInProgress"];
20
20
  /**
21
21
  * @description
22
22
  * @param {{
@@ -24,7 +24,8 @@ const _excluded = ["spaceGateway", "connected", "onDelete", "onConnect", "enable
24
24
  * onDelete: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
25
25
  * onConnect: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
26
26
  * enableSwitchToSpace: true | false,
27
- * connected: false | true
27
+ * connected: false | true,
28
+ * backupInProgress: false | true,
28
29
  * } & import('@mui/material').IconButtonProps} { spaceGateway, onDelete, onConnect, enableSwitchToSpace, connected, ...rest }
29
30
  * @return {React.Component}
30
31
  */
@@ -44,7 +45,8 @@ function SpaceItemAction(_ref) {
44
45
  connected,
45
46
  onDelete,
46
47
  onConnect,
47
- enableSwitchToSpace
48
+ enableSwitchToSpace,
49
+ backupInProgress
48
50
  } = _ref,
49
51
  rest = _objectWithoutProperties(_ref, _excluded);
50
52
  const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
@@ -134,7 +136,7 @@ function SpaceItemAction(_ref) {
134
136
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
135
137
  children: t('storage.spaces.connect.switchToSpace')
136
138
  })]
137
- }), !connected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.default, {
139
+ }), !backupInProgress && /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.default, {
138
140
  spaceGateway: spaceGateway,
139
141
  onDelete: onDelete
140
142
  })]
@@ -152,11 +154,13 @@ SpaceItemAction.propTypes = {
152
154
  connected: _propTypes.default.bool.isRequired,
153
155
  enableSwitchToSpace: _propTypes.default.bool,
154
156
  onDelete: _propTypes.default.func,
155
- onConnect: _propTypes.default.func
157
+ onConnect: _propTypes.default.func,
158
+ backupInProgress: _propTypes.default.bool
156
159
  };
157
160
  SpaceItemAction.defaultProps = {
158
161
  onDelete: () => {},
159
162
  onConnect: () => {},
160
- enableSwitchToSpace: true
163
+ enableSwitchToSpace: true,
164
+ backupInProgress: false
161
165
  };
162
166
  var _default = exports.default = SpaceItemAction;
@@ -455,7 +455,8 @@ function SpaceItem(_ref) {
455
455
  connected: connected,
456
456
  onDelete: onDelete,
457
457
  onConnect: onConnect,
458
- enableSwitchToSpace: (backupProgress === null || backupProgress === void 0 ? void 0 : backupProgress.completed) || (0, _lodash.isEmpty)(backupProgress === null || backupProgress === void 0 ? void 0 : backupProgress.message)
458
+ enableSwitchToSpace: (backupProgress === null || backupProgress === void 0 ? void 0 : backupProgress.completed) || (0, _lodash.isEmpty)(backupProgress === null || backupProgress === void 0 ? void 0 : backupProgress.message),
459
+ backupInProgress: shouldDisplayBackupProgress
459
460
  })]
460
461
  })]
461
462
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
package/lib/confirm.js CHANGED
@@ -22,7 +22,7 @@ var _util = require("./util");
22
22
  var _mobileWidth = _interopRequireDefault(require("./hooks/mobile-width"));
23
23
  var _jsxRuntime = require("react/jsx-runtime");
24
24
  var _templateObject;
25
- const _excluded = ["title", "description", "showCancel", "cancel", "confirm", "color", "params", "onCancel", "onConfirm", "loading", "displayError"];
25
+ const _excluded = ["title", "description", "showCancel", "cancel", "confirm", "color", "params", "onCancel", "onConfirm", "loading", "displayError", "children"];
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
28
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -44,7 +44,8 @@ function ConfirmDialog(_ref) {
44
44
  onCancel,
45
45
  onConfirm,
46
46
  loading: inputLoading,
47
- displayError
47
+ displayError,
48
+ children
48
49
  } = _ref,
49
50
  rest = _objectWithoutProperties(_ref, _excluded);
50
51
  const [params, setParams] = (0, _react.useState)(initialParams);
@@ -107,7 +108,7 @@ function ConfirmDialog(_ref) {
107
108
  marginTop: 8
108
109
  },
109
110
  children: error
110
- })]
111
+ }), children]
111
112
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DialogActions.default, {
112
113
  className: "delete-actions",
113
114
  style: {
@@ -156,9 +157,11 @@ ConfirmDialog.propTypes = {
156
157
  onCancel: _propTypes.default.func,
157
158
  onConfirm: _propTypes.default.func.isRequired,
158
159
  loading: _propTypes.default.bool,
159
- displayError: _propTypes.default.bool
160
+ displayError: _propTypes.default.bool,
161
+ children: _propTypes.default.any
160
162
  };
161
163
  ConfirmDialog.defaultProps = {
164
+ children: undefined,
162
165
  onCancel: () => {},
163
166
  showCancel: true,
164
167
  cancel: '',
@@ -153,10 +153,6 @@ function BlockletStorageProvider(_ref) {
153
153
  if (!spaceGateway) {
154
154
  return;
155
155
  }
156
- if (spaceGateway.endpoint === backupEndpoint) {
157
- _Toast.default.warning(t('storage.spaces.gateway.delete.failedForConnected'));
158
- return;
159
- }
160
156
  await api.deleteBlockletSpaceGateway({
161
157
  input: {
162
158
  did: blocklet.meta.did,
@@ -19,10 +19,13 @@ function Feedback(_ref) {
19
19
  const {
20
20
  t
21
21
  } = (0, _context.useLocaleContext)();
22
+ const feedbackUrl = new URL('https://community.arcblock.io/discussions/add');
23
+ infos.forEach(x => {
24
+ feedbackUrl.searchParams.set(x.label, x.value);
25
+ });
22
26
  const infoStr = infos.map(x => "* ".concat(x.label, ": ").concat(x.value)).join('\n');
23
- const feedbackUrl = new URL('https://github.com/blocklet/blocklet-site/issues/new');
24
- feedbackUrl.searchParams.set('title', '[Feedback]');
25
- feedbackUrl.searchParams.set('body', "<!-- [Enter feedback here] -->\n\n\n\n<!--\nDocument Details\n".concat(infoStr, "\n* Page: ").concat(window.location.href, "\n-->\n"));
27
+ feedbackUrl.searchParams.set('report', 'server');
28
+ feedbackUrl.searchParams.set('context', "[Enter feedback here]\n\n\n\n<!--\n[Server Info]\n".concat(infoStr, "\n* Page: ").concat(window.location.href, "\n-->\n"));
26
29
  return (0, _jsxRuntime.jsx)(_material.Box, {
27
30
  sx: {
28
31
  mx: {