@abtnode/ux 1.16.0-beta-8ee536d7 → 1.16.0-beta-62b42401
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.
- package/lib/blocklet/actions.js +34 -29
- package/lib/blocklet/component/add.js +58 -1
- package/lib/blocklet/component/delete.js +1 -1
- package/lib/blocklet/component/navigation/locale-tabs.js +18 -12
- package/lib/blocklet/component/navigation/navigation-actions.js +5 -5
- package/lib/blocklet/component/navigation/navigation-dialog.js +19 -13
- package/lib/blocklet/component/navigation/navigation-preview.js +11 -9
- package/lib/blocklet/component/navigation/simple-select.js +25 -16
- package/lib/blocklet/component/sortable-tree.js +5 -4
- package/lib/blocklet/component/space-connector.js +208 -0
- package/lib/blocklet/component/{space-gateway-selector.js → space-selector.js} +20 -10
- package/lib/blocklet/config-navigation.js +35 -26
- package/lib/blocklet/oauth/auth0.js +162 -0
- package/lib/blocklet/oauth/index.js +49 -0
- package/lib/blocklet/preferences/index.js +24 -0
- package/lib/blocklet/storage.js +14 -153
- package/lib/invitation/invitation-receive.js +9 -1
- package/lib/locales/en.js +24 -5
- package/lib/locales/zh.js +23 -4
- package/lib/team/members/index.js +9 -0
- package/lib/team/members/issue-passport.js +6 -2
- package/lib/team/members/passports.js +1 -0
- package/package.json +14 -14
|
@@ -12,7 +12,8 @@ var _react2 = require("@iconify/react");
|
|
|
12
12
|
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
15
|
-
var
|
|
15
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
16
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
16
17
|
var _reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
18
|
var _reactDnd = require("react-dnd");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -56,14 +57,14 @@ function TreeTitle(_ref2) {
|
|
|
56
57
|
if (! /*#__PURE__*/(0, _react.isValidElement)(subtitle) && (0, _isObject.default)(subtitle)) {
|
|
57
58
|
subtitleShow = subtitle[locale];
|
|
58
59
|
}
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
60
61
|
display: "flex",
|
|
61
62
|
alignItems: "center",
|
|
62
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
63
64
|
variant: "subtitle1",
|
|
64
65
|
fontSize: 16,
|
|
65
66
|
children: titleShow
|
|
66
|
-
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
67
|
+
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
67
68
|
variant: "body2",
|
|
68
69
|
color: "gray",
|
|
69
70
|
ml: 1.5,
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
9
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
10
|
+
var _constant = require("@blocklet/constant");
|
|
11
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
16
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
17
|
+
var _blocklet = require("../../../lib/contexts/blocklet");
|
|
18
|
+
var _node = require("../../contexts/node");
|
|
19
|
+
var _toast = _interopRequireDefault(require("../../../lib/toast"));
|
|
20
|
+
var _spaceSelector = _interopRequireDefault(require("./space-selector"));
|
|
21
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _excluded = ["onConnect"];
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
* @param {import('@abtnode/client').BlockletState} blocklet
|
|
37
|
+
* @return {*}
|
|
38
|
+
*/
|
|
39
|
+
function useAppUrl(blocklet) {
|
|
40
|
+
var _blocklet$site, _blocklet$site$domain, _blocklet$site$domain2;
|
|
41
|
+
const appUrls = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$site = blocklet.site) === null || _blocklet$site === void 0 ? void 0 : (_blocklet$site$domain = _blocklet$site.domainAliases) === null || _blocklet$site$domain === void 0 ? void 0 : (_blocklet$site$domain2 = _blocklet$site$domain.sort((a, b) => {
|
|
42
|
+
if (a.accessibility.accessible && b.accessibility.accessible) {
|
|
43
|
+
return +a.isProtected - +b.isProtected;
|
|
44
|
+
}
|
|
45
|
+
return +b.accessibility.accessible - +a.accessibility.accessible;
|
|
46
|
+
})) === null || _blocklet$site$domain2 === void 0 ? void 0 : _blocklet$site$domain2.map(domainAlias => {
|
|
47
|
+
var _domainAlias$domainSt;
|
|
48
|
+
const protocol = domainAlias !== null && domainAlias !== void 0 && (_domainAlias$domainSt = domainAlias.domainStatus) !== null && _domainAlias$domainSt !== void 0 && _domainAlias$domainSt.isHttps ? 'https://' : 'http://';
|
|
49
|
+
const value = domainAlias === null || domainAlias === void 0 ? void 0 : domainAlias.value;
|
|
50
|
+
return "".concat(protocol).concat(value);
|
|
51
|
+
}).filter(Boolean);
|
|
52
|
+
const appUrl = appUrls === null || appUrls === void 0 ? void 0 : appUrls[0];
|
|
53
|
+
|
|
54
|
+
// 授权的时候提供 appUrl, 因为 appUrl 可能很久都拿不到值,所以加一个 loading 效果过渡一下
|
|
55
|
+
return {
|
|
56
|
+
appUrl,
|
|
57
|
+
isReady: Boolean(appUrl)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const SpaceConnector = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
61
|
+
let {
|
|
62
|
+
onConnect
|
|
63
|
+
} = _ref,
|
|
64
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
65
|
+
/** @type {{ api: import('@abtnode/client').ABTNodeClient, info: import('@abtnode/client').NodeState }} */
|
|
66
|
+
const {
|
|
67
|
+
api,
|
|
68
|
+
info
|
|
69
|
+
} = (0, _node.useNodeContext)();
|
|
70
|
+
const nodeDid = info.did;
|
|
71
|
+
const {
|
|
72
|
+
t,
|
|
73
|
+
locale
|
|
74
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
75
|
+
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
76
|
+
const {
|
|
77
|
+
blocklet
|
|
78
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
79
|
+
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
|
|
80
|
+
const spaceProps = (0, _react.useMemo)(() => {
|
|
81
|
+
var _blocklet$environment, _blocklet$environment2, _blocklet$environment3, _blocklet$environment4;
|
|
82
|
+
return {
|
|
83
|
+
endpoint: (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$environment = blocklet.environments) === null || _blocklet$environment === void 0 ? void 0 : (_blocklet$environment2 = _blocklet$environment.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)) === null || _blocklet$environment2 === void 0 ? void 0 : _blocklet$environment2.value) || '',
|
|
84
|
+
gatewayUrl: (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$environment3 = blocklet.environments) === null || _blocklet$environment3 === void 0 ? void 0 : (_blocklet$environment4 = _blocklet$environment3.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL)) === null || _blocklet$environment4 === void 0 ? void 0 : _blocklet$environment4.value) || ''
|
|
85
|
+
};
|
|
86
|
+
}, [blocklet]);
|
|
87
|
+
const appName = (0, _util.getAppName)(blocklet);
|
|
88
|
+
const appDescription = (0, _util.getAppDescription)(blocklet);
|
|
89
|
+
const {
|
|
90
|
+
appUrl,
|
|
91
|
+
isReady
|
|
92
|
+
} = useAppUrl(blocklet);
|
|
93
|
+
async function saveSpaceConnectorEndpoint(did, storageEndpoint) {
|
|
94
|
+
await api.configBlocklet({
|
|
95
|
+
input: {
|
|
96
|
+
did: [did],
|
|
97
|
+
configs: [{
|
|
98
|
+
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,
|
|
99
|
+
value: gatewayUrl
|
|
100
|
+
}, {
|
|
101
|
+
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
102
|
+
value: storageEndpoint
|
|
103
|
+
}]
|
|
104
|
+
}
|
|
105
|
+
}).then(() => {
|
|
106
|
+
_toast.default.success(t('storage.spaces.connected', locale));
|
|
107
|
+
}).catch(error => {
|
|
108
|
+
console.error(error);
|
|
109
|
+
_toast.default.error(error.message);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const onAuthorizeConnectSuccess = async (response, decrypt) => {
|
|
113
|
+
await saveSpaceConnectorEndpoint(blocklet.meta.did, decrypt(response.endpoint));
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
116
|
+
open: false
|
|
117
|
+
}));
|
|
118
|
+
onConnect === null || onConnect === void 0 ? void 0 : onConnect();
|
|
119
|
+
}, 3000);
|
|
120
|
+
};
|
|
121
|
+
const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
|
|
122
|
+
open: false
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// eslint-disable-next-line no-shadow
|
|
126
|
+
const handleOnClickAuthorize = async gatewayUrl => {
|
|
127
|
+
if ((0, _lodash.isEmpty)(gatewayUrl)) {
|
|
128
|
+
_toast.default.error(t('storage.spaces.addressCannotEmpty', locale));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
setGatewayUrl(gatewayUrl);
|
|
132
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
133
|
+
action: 'one-click-authorization',
|
|
134
|
+
checkTimeout: 1000 * 300,
|
|
135
|
+
prefix: (0, _urlJoin.default)(gatewayUrl, 'space/api/did'),
|
|
136
|
+
baseUrl: new URL(gatewayUrl).origin,
|
|
137
|
+
checkFn: _axios.default.create({
|
|
138
|
+
baseURL: (0, _urlJoin.default)(gatewayUrl, 'space')
|
|
139
|
+
}).get,
|
|
140
|
+
extraParams: {
|
|
141
|
+
appDid: blocklet.appDid,
|
|
142
|
+
appName,
|
|
143
|
+
appDescription,
|
|
144
|
+
scopes: 'list:object read:object write:object',
|
|
145
|
+
appUrl,
|
|
146
|
+
referrer: window.location.href,
|
|
147
|
+
nodeDid
|
|
148
|
+
},
|
|
149
|
+
onClose: () => {
|
|
150
|
+
// eslint-disable-next-line no-shadow
|
|
151
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
152
|
+
open: false
|
|
153
|
+
}));
|
|
154
|
+
},
|
|
155
|
+
open: true
|
|
156
|
+
}));
|
|
157
|
+
};
|
|
158
|
+
(0, _react.useEffect)(() => {
|
|
159
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
160
|
+
messages: {
|
|
161
|
+
title: t('storage.spaces.authorize.title', {
|
|
162
|
+
appName
|
|
163
|
+
}),
|
|
164
|
+
scan: t('storage.spaces.authorize.scan', {
|
|
165
|
+
appName
|
|
166
|
+
}),
|
|
167
|
+
confirm: '',
|
|
168
|
+
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
169
|
+
gutterBottom: true,
|
|
170
|
+
children: t('storage.spaces.authorize.success')
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
}, [appName, locale, t]);
|
|
175
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
176
|
+
getEndpoint: () => spaceProps.endpoint,
|
|
177
|
+
getGatewayUrl: () => spaceProps.gatewayUrl
|
|
178
|
+
}));
|
|
179
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
180
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceSelector.default, _objectSpread(_objectSpread(_objectSpread({}, restProps), spaceProps), {}, {
|
|
181
|
+
onSelect: handleOnClickAuthorize,
|
|
182
|
+
loading: !isReady
|
|
183
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
184
|
+
forceConnected: false,
|
|
185
|
+
saveConnect: false,
|
|
186
|
+
prefix: authorizeConnect.prefix,
|
|
187
|
+
open: authorizeConnect.open,
|
|
188
|
+
popup: true,
|
|
189
|
+
action: authorizeConnect.action,
|
|
190
|
+
baseUrl: authorizeConnect.baseUrl,
|
|
191
|
+
checkFn: authorizeConnect.checkFn,
|
|
192
|
+
onSuccess: onAuthorizeConnectSuccess,
|
|
193
|
+
onClose: authorizeConnect.onClose,
|
|
194
|
+
checkTimeout: authorizeConnect.checkTimeout,
|
|
195
|
+
extraParams: authorizeConnect.extraParams,
|
|
196
|
+
messages: authorizeConnect.messages,
|
|
197
|
+
locale: locale
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
SpaceConnector.propTypes = {
|
|
202
|
+
onConnect: _propTypes.default.func
|
|
203
|
+
};
|
|
204
|
+
SpaceConnector.defaultProps = {
|
|
205
|
+
onConnect: () => {}
|
|
206
|
+
};
|
|
207
|
+
var _default = SpaceConnector;
|
|
208
|
+
exports.default = _default;
|
|
@@ -18,7 +18,7 @@ var _session = require("../../../lib/contexts/session");
|
|
|
18
18
|
var _toast = _interopRequireDefault(require("../../toast"));
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
var _templateObject;
|
|
21
|
-
const _excluded = ["onSelect", "endpoint", "loading"];
|
|
21
|
+
const _excluded = ["onSelect", "endpoint", "gatewayUrl", "loading", "size", "helperText"];
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -40,15 +40,18 @@ const DEFAULT_GATEWAY_LIST = [{
|
|
|
40
40
|
avatar: 'S'
|
|
41
41
|
}];
|
|
42
42
|
const filter = (0, _Autocomplete.createFilterOptions)();
|
|
43
|
-
function
|
|
43
|
+
function SpaceSelector(_ref) {
|
|
44
44
|
let {
|
|
45
45
|
onSelect,
|
|
46
46
|
endpoint,
|
|
47
|
-
|
|
47
|
+
gatewayUrl: defaultGatewayUrl,
|
|
48
|
+
loading,
|
|
49
|
+
size,
|
|
50
|
+
helperText
|
|
48
51
|
} = _ref,
|
|
49
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
53
|
const [gatewayList, setGatewayList] = (0, _useLocalStorage.default)('did-space-gateway-list', DEFAULT_GATEWAY_LIST);
|
|
51
|
-
const [gatewayUrl, setGatewayUrl] = (0,
|
|
54
|
+
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)(defaultGatewayUrl || DEFAULT_GATEWAY_LIST[0].value);
|
|
52
55
|
const {
|
|
53
56
|
t
|
|
54
57
|
} = (0, _context.useLocaleContext)();
|
|
@@ -134,8 +137,9 @@ function SpaceGatewaySelector(_ref) {
|
|
|
134
137
|
},
|
|
135
138
|
renderInput: params => {
|
|
136
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, params), {}, {
|
|
140
|
+
helperText: helperText,
|
|
137
141
|
label: t('storage.spaces.label'),
|
|
138
|
-
size:
|
|
142
|
+
size: size,
|
|
139
143
|
InputProps: _objectSpread(_objectSpread({}, params.InputProps), {}, {
|
|
140
144
|
type: 'search',
|
|
141
145
|
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
@@ -161,14 +165,20 @@ function SpaceGatewaySelector(_ref) {
|
|
|
161
165
|
}));
|
|
162
166
|
}
|
|
163
167
|
const Container = (0, _styled.default)(_Autocomplete.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 40px;\n width: 100%;\n max-width: 720px;\n ", " {\n width: 75%;\n }\n input.MuiInputBase-input {\n max-width: calc(100% - 80px);\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
164
|
-
|
|
168
|
+
SpaceSelector.propTypes = {
|
|
165
169
|
onSelect: _propTypes.default.func.isRequired,
|
|
166
170
|
endpoint: _propTypes.default.string,
|
|
167
|
-
loading: _propTypes.default.bool
|
|
171
|
+
loading: _propTypes.default.bool,
|
|
172
|
+
size: _propTypes.default.string,
|
|
173
|
+
helperText: _propTypes.default.string,
|
|
174
|
+
gatewayUrl: _propTypes.default.string
|
|
168
175
|
};
|
|
169
|
-
|
|
176
|
+
SpaceSelector.defaultProps = {
|
|
170
177
|
endpoint: undefined,
|
|
171
|
-
loading: false
|
|
178
|
+
loading: false,
|
|
179
|
+
size: 'small',
|
|
180
|
+
helperText: '',
|
|
181
|
+
gatewayUrl: ''
|
|
172
182
|
};
|
|
173
|
-
var _default =
|
|
183
|
+
var _default = SpaceSelector;
|
|
174
184
|
exports.default = _default;
|
|
@@ -5,8 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
9
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
10
|
+
var _ButtonGroup = _interopRequireDefault(require("@mui/material/ButtonGroup"));
|
|
11
|
+
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
12
|
+
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
13
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
|
+
var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
|
|
15
|
+
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
16
|
+
var _Toolbar = _interopRequireDefault(require("@mui/material/Toolbar"));
|
|
17
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
18
|
+
var _LoadingButton = _interopRequireDefault(require("@mui/lab/LoadingButton"));
|
|
10
19
|
var _react2 = require("@iconify/react");
|
|
11
20
|
var _notistack = require("notistack");
|
|
12
21
|
var _ahooks = require("ahooks");
|
|
@@ -113,11 +122,11 @@ function ConfigNavigation() {
|
|
|
113
122
|
variant: 'success'
|
|
114
123
|
});
|
|
115
124
|
} catch (e) {
|
|
116
|
-
enqueueSnackbar( /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
117
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
125
|
+
enqueueSnackbar( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
118
127
|
variant: "subtitle2",
|
|
119
128
|
children: t('navigation.actionFailed')
|
|
120
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
121
130
|
variant: "body1",
|
|
122
131
|
children: (0, _util.formatError)(e) || e.error
|
|
123
132
|
})]
|
|
@@ -136,11 +145,11 @@ function ConfigNavigation() {
|
|
|
136
145
|
variant: 'success'
|
|
137
146
|
});
|
|
138
147
|
} catch (e) {
|
|
139
|
-
enqueueSnackbar( /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
140
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
148
|
+
enqueueSnackbar( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
149
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
141
150
|
variant: "subtitle2",
|
|
142
151
|
children: t('navigation.actionFailed')
|
|
143
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
144
153
|
variant: "body1",
|
|
145
154
|
children: (0, _util.formatError)(e) || e.error
|
|
146
155
|
})]
|
|
@@ -163,32 +172,32 @@ function ConfigNavigation() {
|
|
|
163
172
|
};
|
|
164
173
|
}, [blocklet.appDid, pageState.mockRole]);
|
|
165
174
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
166
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
175
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
167
176
|
variant: "outlined",
|
|
168
177
|
children: Object.keys(navigationTypeMap).map(key => {
|
|
169
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
178
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
170
179
|
variant: navigationState.activeSection === key ? 'contained' : undefined,
|
|
171
180
|
onClick: () => updateActiveSection(key),
|
|
172
181
|
children: [navigationTypeMap[key], " (".concat(getNavigation(key).length, ")")]
|
|
173
182
|
}, key);
|
|
174
183
|
})
|
|
175
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
184
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Toolbar.default, {
|
|
176
185
|
variant: "dense",
|
|
177
186
|
sx: {
|
|
178
187
|
paddingLeft: '0px !important',
|
|
179
188
|
paddingRight: '0px !important',
|
|
180
189
|
mt: 2
|
|
181
190
|
},
|
|
182
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
191
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
183
192
|
variant: "h6",
|
|
184
193
|
component: "div",
|
|
185
194
|
sx: {
|
|
186
195
|
flexGrow: 1
|
|
187
196
|
},
|
|
188
197
|
children: "Config"
|
|
189
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
198
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
190
199
|
variant: "outlined",
|
|
191
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
200
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingButton.default, {
|
|
192
201
|
size: "small",
|
|
193
202
|
variant: "outlined",
|
|
194
203
|
color: "error",
|
|
@@ -205,9 +214,9 @@ function ConfigNavigation() {
|
|
|
205
214
|
},
|
|
206
215
|
children: "\u91CD\u7F6E"
|
|
207
216
|
})
|
|
208
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
217
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
209
218
|
variant: "outlined",
|
|
210
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
219
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
211
220
|
size: "small",
|
|
212
221
|
variant: "outlined",
|
|
213
222
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
|
@@ -215,7 +224,7 @@ function ConfigNavigation() {
|
|
|
215
224
|
}),
|
|
216
225
|
onClick: () => handleAddNavigation(),
|
|
217
226
|
children: "\u65B0\u5EFA"
|
|
218
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
227
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingButton.default, {
|
|
219
228
|
size: "small",
|
|
220
229
|
variant: "contained",
|
|
221
230
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
|
@@ -227,14 +236,14 @@ function ConfigNavigation() {
|
|
|
227
236
|
children: "\u4FDD\u5B58"
|
|
228
237
|
})]
|
|
229
238
|
})]
|
|
230
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
239
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Paper.default, {
|
|
231
240
|
variant: "outlined",
|
|
232
241
|
sx: {
|
|
233
242
|
display: 'flex',
|
|
234
243
|
height: 280,
|
|
235
244
|
overflow: 'hidden'
|
|
236
245
|
},
|
|
237
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
246
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Paper.default, {
|
|
238
247
|
elevation: 0,
|
|
239
248
|
sx: {
|
|
240
249
|
flex: 1,
|
|
@@ -277,41 +286,41 @@ function ConfigNavigation() {
|
|
|
277
286
|
}
|
|
278
287
|
})
|
|
279
288
|
})
|
|
280
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
289
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Toolbar.default, {
|
|
281
290
|
variant: "dense",
|
|
282
291
|
sx: {
|
|
283
292
|
paddingLeft: '0px !important',
|
|
284
293
|
paddingRight: '0px !important',
|
|
285
294
|
mt: 3
|
|
286
295
|
},
|
|
287
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
296
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
288
297
|
variant: "h6",
|
|
289
298
|
component: "div",
|
|
290
299
|
sx: {
|
|
291
300
|
flexGrow: 1
|
|
292
301
|
},
|
|
293
302
|
children: "Preview"
|
|
294
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
303
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
295
304
|
sx: {
|
|
296
305
|
m: 1,
|
|
297
306
|
minWidth: 120
|
|
298
307
|
},
|
|
299
308
|
size: "small",
|
|
300
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
309
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
|
|
301
310
|
children: "Role"
|
|
302
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
311
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
|
|
303
312
|
value: pageState.mockRole,
|
|
304
313
|
label: "Role",
|
|
305
314
|
onChange: e => {
|
|
306
315
|
pageState.mockRole = e.target.value;
|
|
307
316
|
},
|
|
308
|
-
children: roles.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
317
|
+
children: roles.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
309
318
|
value: item.name,
|
|
310
319
|
children: item.title
|
|
311
320
|
}, item.name))
|
|
312
321
|
})]
|
|
313
322
|
})]
|
|
314
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
323
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Paper.default, {
|
|
315
324
|
variant: "outlined",
|
|
316
325
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Session.SessionContext.Provider, {
|
|
317
326
|
value: sessionCtxValue,
|
|
@@ -0,0 +1,162 @@
|
|
|
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 _node = require("../../contexts/node");
|
|
13
|
+
var _blocklet = require("../../contexts/blocklet");
|
|
14
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21
|
+
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); }
|
|
22
|
+
function OAuthAuth0() {
|
|
23
|
+
var _blocklet$meta, _blocklet$settings, _blocklet$settings$oa;
|
|
24
|
+
const {
|
|
25
|
+
api
|
|
26
|
+
} = (0, _node.useNodeContext)();
|
|
27
|
+
const {
|
|
28
|
+
blocklet
|
|
29
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
30
|
+
const {
|
|
31
|
+
t
|
|
32
|
+
} = (0, _context.useLocaleContext)();
|
|
33
|
+
// TODO: @zhanghan 将来需要换成 permanent did
|
|
34
|
+
const did = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
|
|
35
|
+
const auth0 = Object.assign({
|
|
36
|
+
enabled: false,
|
|
37
|
+
domain: '',
|
|
38
|
+
clientId: ''
|
|
39
|
+
}, (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : (_blocklet$settings$oa = _blocklet$settings.oauth) === null || _blocklet$settings$oa === void 0 ? void 0 : _blocklet$settings$oa.auth0) || {});
|
|
40
|
+
const {
|
|
41
|
+
handleSubmit,
|
|
42
|
+
control,
|
|
43
|
+
formState,
|
|
44
|
+
watch,
|
|
45
|
+
reset
|
|
46
|
+
} = (0, _reactHookForm.useForm)({
|
|
47
|
+
defaultValues: (0, _pick.default)(auth0, ['domain', 'clientId', 'enabled'])
|
|
48
|
+
});
|
|
49
|
+
const enabled = watch('enabled');
|
|
50
|
+
const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
|
|
51
|
+
try {
|
|
52
|
+
var _blockletChanged$sett, _blockletChanged$sett2;
|
|
53
|
+
const {
|
|
54
|
+
blocklet: blockletChanged
|
|
55
|
+
} = await api.configOAuth({
|
|
56
|
+
input: {
|
|
57
|
+
did,
|
|
58
|
+
oauth: JSON.stringify({
|
|
59
|
+
auth0: data
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const defaultValues = Object.assign({
|
|
64
|
+
enabled: false,
|
|
65
|
+
domain: '',
|
|
66
|
+
clientId: ''
|
|
67
|
+
}, (blockletChanged === null || blockletChanged === void 0 ? void 0 : (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 ? void 0 : (_blockletChanged$sett2 = _blockletChanged$sett.oauth) === null || _blockletChanged$sett2 === void 0 ? void 0 : _blockletChanged$sett2.auth0) || {});
|
|
68
|
+
// 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
|
|
69
|
+
reset(defaultValues);
|
|
70
|
+
_toast.default.success(t('oauth.saveSuccess'));
|
|
71
|
+
} catch (err) {
|
|
72
|
+
_toast.default.success(err.message || t('oauth.saveFailed'));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const validateDomain = (0, _ahooks.useMemoizedFn)(val => {
|
|
76
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
77
|
+
return t('oauth.auth0.domainDescribe');
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
const validateClientId = (0, _ahooks.useMemoizedFn)(val => {
|
|
82
|
+
if (!(val !== null && val !== void 0 && val.trim())) {
|
|
83
|
+
return t('oauth.auth0.clientIdDescribe');
|
|
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)(_material.Switch, _objectSpread({
|
|
101
|
+
checked: field.value
|
|
102
|
+
}, field)),
|
|
103
|
+
label: t('oauth.auth0.enable'),
|
|
104
|
+
sx: {
|
|
105
|
+
marginBottom: '8px'
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
110
|
+
name: "domain",
|
|
111
|
+
control: control,
|
|
112
|
+
rules: {
|
|
113
|
+
validate: enabled ? validateDomain : noop
|
|
114
|
+
},
|
|
115
|
+
render: _ref2 => {
|
|
116
|
+
var _formState$errors$fie;
|
|
117
|
+
let {
|
|
118
|
+
field
|
|
119
|
+
} = _ref2;
|
|
120
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
121
|
+
fullWidth: true,
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
123
|
+
label: t('oauth.auth0.domain'),
|
|
124
|
+
error: !!formState.errors[field.name],
|
|
125
|
+
helperText: ((_formState$errors$fie = formState.errors[field.name]) === null || _formState$errors$fie === void 0 ? void 0 : _formState$errors$fie.message) || ' ',
|
|
126
|
+
disabled: !enabled
|
|
127
|
+
}))
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
131
|
+
name: "clientId",
|
|
132
|
+
control: control,
|
|
133
|
+
rules: {
|
|
134
|
+
validate: enabled ? validateClientId : noop
|
|
135
|
+
},
|
|
136
|
+
render: _ref3 => {
|
|
137
|
+
var _formState$errors$fie2;
|
|
138
|
+
let {
|
|
139
|
+
field
|
|
140
|
+
} = _ref3;
|
|
141
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
142
|
+
fullWidth: true,
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
|
|
144
|
+
error: !!formState.errors[field.name],
|
|
145
|
+
label: t('oauth.auth0.clientId'),
|
|
146
|
+
helperText: ((_formState$errors$fie2 = formState.errors[field.name]) === null || _formState$errors$fie2 === void 0 ? void 0 : _formState$errors$fie2.message) || ' ',
|
|
147
|
+
disabled: !enabled
|
|
148
|
+
}))
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
152
|
+
type: "submit",
|
|
153
|
+
variant: "contained",
|
|
154
|
+
onSubmit: handleSubmit(onSubmit),
|
|
155
|
+
disabled: !formState.isDirty,
|
|
156
|
+
children: t('oauth.save')
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
var _default = OAuthAuth0;
|
|
162
|
+
exports.default = _default;
|