@abtnode/ux 1.15.17 → 1.16.0-beta-8ee536d7
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/actions.js +111 -0
- package/lib/blocklet/access/config-access.js +303 -0
- package/lib/blocklet/access/index.js +221 -0
- package/lib/blocklet/actions.js +438 -0
- package/lib/blocklet/add-cert.js +191 -0
- package/lib/blocklet/agreement-app.js +30 -0
- package/lib/blocklet/agreement.js +72 -0
- package/lib/blocklet/app-avatar.js +74 -0
- package/lib/blocklet/audit-logs.js +197 -0
- package/lib/blocklet/blocklet-source.js +56 -0
- package/lib/blocklet/bundle-avatar.js +80 -0
- package/lib/blocklet/component/add.js +1063 -0
- package/lib/blocklet/component/configuration.js +124 -0
- package/lib/blocklet/component/delete.js +117 -0
- package/lib/blocklet/component/environment.js +289 -0
- package/lib/blocklet/component/expiration.js +53 -0
- package/lib/blocklet/component/index.js +804 -0
- package/lib/blocklet/component/line.js +28 -0
- package/lib/blocklet/component/navigation/locale-tabs.js +218 -0
- package/lib/blocklet/component/navigation/navigation-actions.js +120 -0
- package/lib/blocklet/component/navigation/navigation-dialog.js +620 -0
- package/lib/blocklet/component/navigation/navigation-preview.js +102 -0
- package/lib/blocklet/component/navigation/simple-select.js +131 -0
- package/lib/blocklet/component/select-store.js +153 -0
- package/lib/blocklet/component/setting.js +151 -0
- package/lib/blocklet/component/sortable-tree.js +138 -0
- package/lib/blocklet/component/space-gateway-selector.js +174 -0
- package/lib/blocklet/component/store-blocklet-list.js +205 -0
- package/lib/blocklet/config-navigation.js +344 -0
- package/lib/blocklet/configuration.js +574 -0
- package/lib/blocklet/disk-info.js +91 -0
- package/lib/blocklet/icons.js +26 -0
- package/lib/blocklet/install-from-url.js +347 -0
- package/lib/blocklet/log.js +62 -0
- package/lib/blocklet/migration.js +153 -0
- package/lib/blocklet/mode.js +35 -0
- package/lib/blocklet/monitor.js +186 -0
- package/lib/blocklet/overview.js +236 -0
- package/lib/blocklet/preferences/app-sk.js +131 -0
- package/lib/blocklet/preferences/index.js +238 -0
- package/lib/blocklet/preferences/wallet-type.js +107 -0
- package/lib/blocklet/purchase/common.js +103 -0
- package/lib/blocklet/purchase/component-purchase.js +253 -0
- package/lib/blocklet/purchase/index.js +13 -0
- package/lib/blocklet/router/action/add-domain-alias.js +173 -0
- package/lib/blocklet/router/action/add-rule.js +204 -0
- package/lib/blocklet/router/action/config-routing-rule.js +129 -0
- package/lib/blocklet/router/action/delete-domain-alias.js +107 -0
- package/lib/blocklet/router/action/delete-rule.js +114 -0
- package/lib/blocklet/router/action/update-rule.js +203 -0
- package/lib/blocklet/router/domain-actions.js +71 -0
- package/lib/blocklet/router/domain-status.js +96 -0
- package/lib/blocklet/router/rule-actions.js +77 -0
- package/lib/blocklet/router/rule-list.js +181 -0
- package/lib/blocklet/router/util.js +146 -0
- package/lib/blocklet/runtime-info.js +87 -0
- package/lib/blocklet/status.js +105 -0
- package/lib/blocklet/storage.js +322 -0
- package/lib/blocklet/types.js +25 -0
- package/lib/blocklet/util.js +233 -0
- package/lib/blocklet/version.js +156 -0
- package/lib/card-selector.js +109 -0
- package/lib/certificate.js +110 -0
- package/lib/click-to-copy.js +38 -0
- package/lib/confirm.js +149 -0
- package/lib/contexts/audit-log.js +141 -0
- package/lib/contexts/blocklet.js +19 -0
- package/lib/contexts/deleting-blocklets.js +78 -0
- package/lib/contexts/node.js +30 -0
- package/lib/contexts/session.js +20 -0
- package/lib/contexts/team.js +19 -0
- package/lib/delete-confirm.js +127 -0
- package/lib/did-address.js +77 -0
- package/lib/dot.js +18 -0
- package/lib/form/form-text-input.js +266 -0
- package/lib/form/form-wrapper.js +13 -0
- package/lib/form/required.js +13 -0
- package/lib/hooks/blocklet.js +231 -0
- package/lib/hooks/mobile-width.js +19 -0
- package/lib/hooks/url-evaluation.js +168 -0
- package/lib/hooks/use-app-logo.js +25 -0
- package/lib/hooks/use-bundle-logo.js +36 -0
- package/lib/hooks/use-navigation.js +355 -0
- package/lib/hooks/use-passport-id.js +21 -0
- package/lib/hooks/use-subscription.js +28 -0
- package/lib/icons/long-arrow.svg +5 -0
- package/lib/index.js +0 -3
- package/lib/invitation/invitation-app.js +51 -0
- package/lib/invitation/invitation-login.js +47 -0
- package/lib/invitation/invitation-passport.js +130 -0
- package/lib/invitation/invitation-receive.js +108 -0
- package/lib/invitation/invitation-success.js +82 -0
- package/lib/invitation/invitation-user.js +79 -0
- package/lib/invitation/invitation.js +80 -0
- package/lib/issue-passport.js +84 -84
- package/lib/launch-blocklet/content-layout.js +33 -0
- package/lib/launch-blocklet/page-header.js +38 -0
- package/lib/layout/addon.js +100 -0
- package/lib/layout/feedback.js +55 -0
- package/lib/locales/en.js +1221 -10
- package/lib/locales/index.js +3 -4
- package/lib/locales/zh.js +1232 -15
- package/lib/logs/clock.js +19 -0
- package/lib/logs/download.js +139 -0
- package/lib/logs/log-terminal.js +183 -0
- package/lib/lost-passport.js +207 -192
- package/lib/monitor/card.js +73 -0
- package/lib/monitor/cpu.js +109 -0
- package/lib/monitor/disk.js +122 -0
- package/lib/monitor/memory.js +144 -0
- package/lib/nav-logo.js +120 -0
- package/lib/passport-tag.js +43 -0
- package/lib/permission.js +70 -0
- package/lib/relative-time.js +61 -0
- package/lib/schema-form/color-input.js +105 -0
- package/lib/schema-form/common-prop-types.js +21 -0
- package/lib/schema-form/index.js +229 -0
- package/lib/schema-form/passport-input.js +66 -0
- package/lib/schema-form/text-input.js +72 -0
- package/lib/store/add.js +185 -0
- package/lib/store/delete.js +102 -0
- package/lib/store/item.js +84 -0
- package/lib/table-icons.js +42 -0
- package/lib/table.js +13 -0
- package/lib/tag.js +37 -0
- package/lib/team/members/actions.js +99 -0
- package/lib/team/members/index.js +503 -0
- package/lib/team/members/invitations.js +196 -0
- package/lib/team/members/invite-member.js +212 -0
- package/lib/team/members/issue-passport.js +155 -0
- package/lib/team/members/member.js +300 -0
- package/lib/team/members/passport-issuances.js +154 -0
- package/lib/team/members/passports.js +336 -0
- package/lib/team/members/toggle-user-approval.js +128 -0
- package/lib/team/members/transfer-node.js +262 -0
- package/lib/team/members/util.js +20 -0
- package/lib/team/passports/color.js +132 -0
- package/lib/team/passports/detail.js +271 -0
- package/lib/team/passports/index.js +233 -0
- package/lib/team/passports/mutate-role.js +204 -0
- package/lib/team/passports/trusted-issuer.js +297 -0
- package/lib/team/passports/trusted-issuers.js +240 -0
- package/lib/team/search-input.js +38 -0
- package/lib/team/styles/dialog.js +13 -0
- package/lib/team/styles/list-header.js +13 -0
- package/lib/toast.js +86 -0
- package/lib/util/api.js +21 -0
- package/lib/util/constants.js +10 -0
- package/lib/util/index.js +703 -0
- package/lib/util/locales.js +28 -0
- package/lib/util/mode.js +11 -0
- package/lib/who-can-access/config.js +46 -0
- package/lib/wrap-locale.js +12 -13
- package/package.json +71 -17
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = BlockletPreferences;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactIframe = _interopRequireDefault(require("react-iframe"));
|
|
11
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
12
|
+
var _constant = require("@abtnode/constant");
|
|
13
|
+
var _material = require("@mui/material");
|
|
14
|
+
var _TuneRounded = _interopRequireDefault(require("@mui/icons-material/TuneRounded"));
|
|
15
|
+
var _Key = _interopRequireDefault(require("@mui/icons-material/Key"));
|
|
16
|
+
var _SettingsOutlined = _interopRequireDefault(require("@mui/icons-material/SettingsOutlined"));
|
|
17
|
+
var _ChevronRight = _interopRequireDefault(require("@mui/icons-material/ChevronRight"));
|
|
18
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
19
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
20
|
+
var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
21
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
22
|
+
var _bundleAvatar = _interopRequireDefault(require("../bundle-avatar"));
|
|
23
|
+
var _configuration = _interopRequireDefault(require("../configuration"));
|
|
24
|
+
var _index = _interopRequireDefault(require("../access/index"));
|
|
25
|
+
var _node = require("../../contexts/node");
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
var _templateObject;
|
|
28
|
+
const _excluded = ["blocklet", "onUpdate"];
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
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); }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
const addComponentTabs = function addComponentTabs(tabs, blocklet) {
|
|
41
|
+
let ancestors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
42
|
+
let depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
43
|
+
const key = [...ancestors.map(x => x.meta.did), blocklet.meta.did].join('/');
|
|
44
|
+
tabs.push({
|
|
45
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
46
|
+
pl: Math.max(1, depth - 1) * 2,
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "flex-start",
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bundleAvatar.default, {
|
|
51
|
+
size: 24,
|
|
52
|
+
blocklet: blocklet,
|
|
53
|
+
ancestors: ancestors
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
55
|
+
ml: "16px",
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
57
|
+
style: {
|
|
58
|
+
color: '#222'
|
|
59
|
+
},
|
|
60
|
+
children: (0, _util.getDisplayName)(blocklet, true)
|
|
61
|
+
})
|
|
62
|
+
})]
|
|
63
|
+
}, key),
|
|
64
|
+
value: key
|
|
65
|
+
});
|
|
66
|
+
if (blocklet.children.length > 0) {
|
|
67
|
+
blocklet.children.forEach(x => {
|
|
68
|
+
addComponentTabs(tabs, x, [...ancestors, blocklet], depth + 1);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function BlockletPreferences(_ref) {
|
|
73
|
+
let {
|
|
74
|
+
blocklet,
|
|
75
|
+
onUpdate
|
|
76
|
+
} = _ref,
|
|
77
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
78
|
+
const {
|
|
79
|
+
t
|
|
80
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
81
|
+
const {
|
|
82
|
+
info,
|
|
83
|
+
inService
|
|
84
|
+
} = (0, _node.useNodeContext)();
|
|
85
|
+
const [current, setCurrent] = (0, _react.useState)('general');
|
|
86
|
+
const [expandPref, setExpandPref] = (0, _react.useState)(true);
|
|
87
|
+
const tabs = [{
|
|
88
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
"data-cy": "configuration-tab-general",
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TuneRounded.default, {
|
|
93
|
+
sx: {
|
|
94
|
+
fontSize: 24
|
|
95
|
+
}
|
|
96
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
97
|
+
ml: "16px",
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
99
|
+
style: {
|
|
100
|
+
color: '#222'
|
|
101
|
+
},
|
|
102
|
+
children: t('common.general')
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
}, "general"),
|
|
106
|
+
value: 'general'
|
|
107
|
+
}, {
|
|
108
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
109
|
+
display: "flex",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
"data-cy": "configuration-tab-access",
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Key.default, {
|
|
113
|
+
sx: {
|
|
114
|
+
fontSize: 24
|
|
115
|
+
}
|
|
116
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
117
|
+
ml: "16px",
|
|
118
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
119
|
+
style: {
|
|
120
|
+
color: '#222'
|
|
121
|
+
},
|
|
122
|
+
children: t('common.access')
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
}, "access"),
|
|
126
|
+
value: 'access'
|
|
127
|
+
}, {
|
|
128
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
129
|
+
display: "flex",
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
"data-cy": "configuration-tab-preference",
|
|
132
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
133
|
+
ml: -2,
|
|
134
|
+
style: {
|
|
135
|
+
transform: 'translateY(2px)'
|
|
136
|
+
},
|
|
137
|
+
children: expandPref ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
138
|
+
fontSize: "inherit"
|
|
139
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronRight.default, {
|
|
140
|
+
fontSize: "inherit"
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingsOutlined.default, {
|
|
143
|
+
sx: {
|
|
144
|
+
fontSize: 24
|
|
145
|
+
}
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
147
|
+
ml: "16px",
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
149
|
+
style: {
|
|
150
|
+
color: '#222'
|
|
151
|
+
},
|
|
152
|
+
children: t('common.preferences')
|
|
153
|
+
})
|
|
154
|
+
})]
|
|
155
|
+
}, "preference"),
|
|
156
|
+
value: 'preference'
|
|
157
|
+
}];
|
|
158
|
+
if (expandPref) {
|
|
159
|
+
addComponentTabs(tabs, blocklet);
|
|
160
|
+
}
|
|
161
|
+
const onTabChange = x => {
|
|
162
|
+
if (x === 'preference') {
|
|
163
|
+
setExpandPref(!expandPref);
|
|
164
|
+
} else {
|
|
165
|
+
setCurrent(x);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
let content = null;
|
|
169
|
+
if (current === 'general') {
|
|
170
|
+
content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_configuration.default, {
|
|
171
|
+
blocklet: blocklet,
|
|
172
|
+
onUpdate: onUpdate
|
|
173
|
+
});
|
|
174
|
+
} else if (current === 'access') {
|
|
175
|
+
content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {});
|
|
176
|
+
} else {
|
|
177
|
+
// eslint-disable-next-line no-nested-ternary
|
|
178
|
+
const pathPrefix = inService ? _constant.WELLKNOWN_SERVICE_PATH_PREFIX : process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
179
|
+
const searchParams = new URLSearchParams();
|
|
180
|
+
if (!inService) {
|
|
181
|
+
searchParams.set('authKey', '__sst');
|
|
182
|
+
}
|
|
183
|
+
searchParams.set('schemaKey', (0, _urlJoin.default)(window.location.origin, pathPrefix, "/api/preferences?id=".concat(encodeURIComponent(current))));
|
|
184
|
+
content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIframe.default, {
|
|
185
|
+
url: "".concat((0, _urlJoin.default)(window.location.origin, pathPrefix, '/hosted/form-collector/'), "?").concat(searchParams.toString()),
|
|
186
|
+
width: "100%",
|
|
187
|
+
height: "100%",
|
|
188
|
+
frameBorder: 0,
|
|
189
|
+
styles: {
|
|
190
|
+
border: 0
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, _objectSpread(_objectSpread({}, rest), {}, {
|
|
195
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
196
|
+
container: true,
|
|
197
|
+
spacing: 4,
|
|
198
|
+
columns: 24,
|
|
199
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
200
|
+
item: true,
|
|
201
|
+
sm: 7,
|
|
202
|
+
md: 5,
|
|
203
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
204
|
+
tabs: tabs,
|
|
205
|
+
current: current,
|
|
206
|
+
orientation: "vertical",
|
|
207
|
+
onChange: onTabChange,
|
|
208
|
+
sx: {
|
|
209
|
+
borderRight: 1,
|
|
210
|
+
height: '100%',
|
|
211
|
+
borderColor: 'divider'
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
215
|
+
item: true,
|
|
216
|
+
sm: 17,
|
|
217
|
+
md: 19,
|
|
218
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
219
|
+
style: {
|
|
220
|
+
minHeight: '66vh',
|
|
221
|
+
height: '100%',
|
|
222
|
+
position: 'relative',
|
|
223
|
+
overflow: 'hidden'
|
|
224
|
+
},
|
|
225
|
+
children: content
|
|
226
|
+
})
|
|
227
|
+
})]
|
|
228
|
+
})
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
BlockletPreferences.propTypes = {
|
|
232
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
233
|
+
onUpdate: _propTypes.default.func
|
|
234
|
+
};
|
|
235
|
+
BlockletPreferences.defaultProps = {
|
|
236
|
+
onUpdate: () => {}
|
|
237
|
+
};
|
|
238
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])));
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = WalletType;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
11
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
13
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
|
+
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
19
|
+
function WalletType(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
disabled
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
t
|
|
27
|
+
} = (0, _context.useLocaleContext)();
|
|
28
|
+
const [confirmCustomType, setConfirmCustomType] = (0, _react.useState)(null);
|
|
29
|
+
const WalletTypes = [{
|
|
30
|
+
label: 'DID',
|
|
31
|
+
value: 'default'
|
|
32
|
+
}, {
|
|
33
|
+
label: 'ETH',
|
|
34
|
+
value: 'eth'
|
|
35
|
+
}];
|
|
36
|
+
const onWalletTypeChange = async e => {
|
|
37
|
+
setConfirmCustomType({
|
|
38
|
+
value: e.target.value
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const _onConfirm = async v => {
|
|
42
|
+
try {
|
|
43
|
+
await onChange(v);
|
|
44
|
+
} finally {
|
|
45
|
+
setConfirmCustomType(null);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
select: true,
|
|
51
|
+
size: "small",
|
|
52
|
+
value: value || 'default',
|
|
53
|
+
onChange: onWalletTypeChange,
|
|
54
|
+
children: WalletTypes.map(type => {
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMenuItem, {
|
|
56
|
+
value: type.value,
|
|
57
|
+
sx: {
|
|
58
|
+
display: 'block'
|
|
59
|
+
},
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
61
|
+
display: "flex",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
64
|
+
children: type.label
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
}), confirmCustomType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
70
|
+
title: t('blocklet.config.walletTypeTitle'),
|
|
71
|
+
description: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
72
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
73
|
+
dangerouslySetInnerHTML: {
|
|
74
|
+
__html: t('blocklet.config.blockletTypeChangeTip', {
|
|
75
|
+
value: WalletTypes.find(x => x.value === confirmCustomType.value).label
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
79
|
+
fontWeight: "bold",
|
|
80
|
+
mt: 2,
|
|
81
|
+
children: t('blocklet.config.appDidChangeTip')
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(UL, {
|
|
83
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
84
|
+
children: t('blocklet.config.appDidChangeTipL1')
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
86
|
+
children: t('blocklet.config.appDidChangeTipL2')
|
|
87
|
+
})]
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
confirm: t('confirm'),
|
|
91
|
+
cancel: t('cancel'),
|
|
92
|
+
onConfirm: () => _onConfirm(confirmCustomType.value),
|
|
93
|
+
onCancel: () => setConfirmCustomType(null)
|
|
94
|
+
})];
|
|
95
|
+
}
|
|
96
|
+
WalletType.propTypes = {
|
|
97
|
+
value: _propTypes.default.string,
|
|
98
|
+
onChange: _propTypes.default.func,
|
|
99
|
+
disabled: _propTypes.default.bool
|
|
100
|
+
};
|
|
101
|
+
WalletType.defaultProps = {
|
|
102
|
+
value: 'default',
|
|
103
|
+
onChange: () => {},
|
|
104
|
+
disabled: false
|
|
105
|
+
};
|
|
106
|
+
const StyledMenuItem = (0, _styled.default)(_MenuItem.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tip {\n font-size: 12px;\n color: ", ";\n }\n"])), props => props.theme.palette.text.secondary);
|
|
107
|
+
const UL = (0, _styled.default)('ul')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CustomSelect = CustomSelect;
|
|
7
|
+
exports.useStyles = exports.commonProps = void 0;
|
|
8
|
+
var _styles = require("@mui/styles");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _List = _interopRequireDefault(require("@mui/material/List"));
|
|
11
|
+
var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
|
|
12
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
13
|
+
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
14
|
+
var _ShoppingCart = _interopRequireDefault(require("@mui/icons-material/ShoppingCart"));
|
|
15
|
+
var _VerifiedUser = _interopRequireDefault(require("@mui/icons-material/VerifiedUser"));
|
|
16
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
|
+
var _Colors = _interopRequireDefault(require("@arcblock/ux/lib/Colors"));
|
|
18
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
const commonProps = {
|
|
22
|
+
meta: _propTypes.default.object.isRequired,
|
|
23
|
+
onCancel: _propTypes.default.func.isRequired
|
|
24
|
+
};
|
|
25
|
+
exports.commonProps = commonProps;
|
|
26
|
+
const useStyles = (0, _styles.makeStyles)(() => ({
|
|
27
|
+
dialogAuth: {
|
|
28
|
+
padding: '0 0 24px !important',
|
|
29
|
+
'& .auth-title': {
|
|
30
|
+
textAlign: 'center !important',
|
|
31
|
+
marginBottom: '4px !important'
|
|
32
|
+
},
|
|
33
|
+
'& .auth-tip--scan': {
|
|
34
|
+
textAlign: 'center !important'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
iconRoot: {
|
|
38
|
+
minWidth: 48
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
exports.useStyles = useStyles;
|
|
42
|
+
function CustomSelect(_ref) {
|
|
43
|
+
let {
|
|
44
|
+
action,
|
|
45
|
+
onSelect,
|
|
46
|
+
onNext
|
|
47
|
+
} = _ref;
|
|
48
|
+
const classes = useStyles();
|
|
49
|
+
const {
|
|
50
|
+
t
|
|
51
|
+
} = (0, _context.useLocaleContext)();
|
|
52
|
+
const options = [{
|
|
53
|
+
action: 'purchase',
|
|
54
|
+
title: t('store.purchase.purchase.title'),
|
|
55
|
+
description: t('store.purchase.purchase.description')
|
|
56
|
+
}, {
|
|
57
|
+
action: 'verify',
|
|
58
|
+
title: t('store.purchase.verify.title'),
|
|
59
|
+
description: t('store.purchase.verify.description')
|
|
60
|
+
}];
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_List.default, {
|
|
63
|
+
className: classes.tabPanel,
|
|
64
|
+
children: options.map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListItem.default, {
|
|
65
|
+
button: true,
|
|
66
|
+
selected: action === x.action,
|
|
67
|
+
onClick: () => onSelect(x.action),
|
|
68
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
69
|
+
className: classes.iconRoot,
|
|
70
|
+
children: x.action === 'purchase' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ShoppingCart.default, {
|
|
71
|
+
style: {
|
|
72
|
+
color: action === 'purchase' ? _Colors.default.primary.main : '#AAA',
|
|
73
|
+
fontSize: 32
|
|
74
|
+
}
|
|
75
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_VerifiedUser.default, {
|
|
76
|
+
style: {
|
|
77
|
+
color: action === 'verify' ? _Colors.default.primary.main : '#AAA',
|
|
78
|
+
fontSize: 32
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
82
|
+
primary: x.title,
|
|
83
|
+
secondary: x.description
|
|
84
|
+
})]
|
|
85
|
+
}, x.action))
|
|
86
|
+
}), onNext && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
87
|
+
fullWidth: true,
|
|
88
|
+
disabled: !action,
|
|
89
|
+
variant: "contained",
|
|
90
|
+
color: "primary",
|
|
91
|
+
style: {
|
|
92
|
+
marginTop: 16
|
|
93
|
+
},
|
|
94
|
+
onClick: onNext,
|
|
95
|
+
children: t('common.next')
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
CustomSelect.propTypes = {
|
|
100
|
+
action: _propTypes.default.oneOf(['both', 'purchase', 'verify']).isRequired,
|
|
101
|
+
onSelect: _propTypes.default.func.isRequired,
|
|
102
|
+
onNext: _propTypes.default.func.isRequired
|
|
103
|
+
};
|