@abtnode/ux 1.16.18-beta-adeeb0b3 → 1.16.18-beta-aa01bd8e

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.
@@ -6,1019 +6,50 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = AddComponent;
7
7
  var _react = require("react");
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
10
- var _flatten = _interopRequireDefault(require("lodash/flatten"));
11
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
12
- var _isNil = _interopRequireDefault(require("lodash/isNil"));
13
- var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/page-header"));
14
9
  var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
15
- var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
16
- var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
17
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
18
- var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
19
10
  var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
20
11
  var _Link = _interopRequireDefault(require("@mui/icons-material/Link"));
21
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
22
12
  var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
23
13
  var _styled = _interopRequireDefault(require("@emotion/styled"));
24
14
  var _context = require("@arcblock/ux/lib/Locale/context");
25
- var _constant = require("@blocklet/constant");
26
- var _launcherLayout = _interopRequireDefault(require("@blocklet/launcher-layout"));
27
- var _step = require("@blocklet/launcher-layout/lib/context/step");
28
- var _Box = _interopRequireDefault(require("@mui/material/Box"));
29
- var _constant2 = require("@abtnode/constant");
30
- var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
31
- var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
32
- var _AnimationWaiter = _interopRequireDefault(require("@arcblock/ux/lib/AnimationWaiter"));
33
- var _launchResultMessage = _interopRequireDefault(require("@blocklet/launcher-layout/lib/launch-result-message"));
34
15
  var _util = require("@blocklet/meta/lib/util");
35
- var _urlPathFriendly = _interopRequireDefault(require("@blocklet/meta/lib/url-path-friendly"));
36
- var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
16
+ var _constants = require("../../util/constants");
37
17
  var _node = require("../../contexts/node");
38
- var _blocklet = require("../../contexts/blocklet");
39
- var _util2 = require("../../util");
40
- var _schemaForm = _interopRequireDefault(require("../../schema-form"));
41
- var _required = _interopRequireDefault(require("../../form/required"));
42
- var _purchase = require("../purchase");
43
- var _util3 = require("../router/util");
44
- var _agreement = _interopRequireDefault(require("../agreement"));
45
- var _installFromUrl = _interopRequireDefault(require("../install-from-url"));
46
- var _selectStore = _interopRequireDefault(require("./select-store"));
47
- var _storeBlockletList = _interopRequireDefault(require("./store-blocklet-list"));
48
- var _spaceConnector = _interopRequireDefault(require("./space-connector"));
18
+ var _addComponentCore = _interopRequireDefault(require("./add-component-core"));
49
19
  var _jsxRuntime = require("react/jsx-runtime");
50
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
51
- const _excluded = ["name", "validation"],
52
- _excluded2 = ["default", "key"];
20
+ var _templateObject;
21
+ /* eslint-disable react/no-unstable-nested-components */
53
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
54
23
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
55
- 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; }
56
- 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; }
57
- 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; }
58
- 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; }
59
- 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; }
60
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
61
- 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); } /* eslint-disable react/no-unstable-nested-components */
62
- const requirePurchase = meta => meta.inStore && (0, _util.isFreeBlocklet)(meta) === false;
63
- const getDIDSpaceCapability = meta => {
64
- var _meta$capabilities;
65
- return meta === null || meta === void 0 ? void 0 : (_meta$capabilities = meta.capabilities) === null || _meta$capabilities === void 0 ? void 0 : _meta$capabilities.didSpace;
66
- };
67
- /**
68
- * @description
69
- * @param {import('@abtnode/client').BlockletState} blocklet
70
- * @return {string}
71
- */
72
- const getDIDSpaceEndpoint = blocklet => {
73
- var _blocklet$configs, _blocklet$configs$fin;
74
- return (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$configs = blocklet.configs) === null || _blocklet$configs === void 0 ? void 0 : (_blocklet$configs$fin = _blocklet$configs.find(item => item.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)) === null || _blocklet$configs$fin === void 0 ? void 0 : _blocklet$configs$fin.value) || null;
75
- };
76
- const hasRequiredEnvironments = meta => (meta.environments || []).some(x => x.required);
77
- const hasMissRequiredConfigs = (configsList, sharedValueMap) => {
78
- return configsList === null || configsList === void 0 ? void 0 : configsList.some(item => {
79
- return item.required && !sharedValueMap[item.key];
80
- });
81
- };
82
- const getParamsName = function getParamsName() {
83
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
84
- return params.title || params.name;
85
- };
86
- const StepContent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
87
- let {
88
- meta,
89
- isMobile,
90
- onStepChange
91
- } = _ref;
92
- const {
93
- steps,
94
- activeStep,
95
- setActiveStepByKey,
96
- setActiveStepByIndex
97
- } = (0, _step.useStepContext)();
98
- const {
99
- t,
100
- locale
101
- } = (0, _context.useLocaleContext)();
102
- const step = steps[activeStep];
103
- (0, _react.useEffect)(() => {
104
- onStepChange(activeStep);
105
- }, [onStepChange, activeStep]);
106
-
107
- // expose the func and activeStep
108
- (0, _react.useImperativeHandle)(ref, () => ({
109
- setActiveStepByKey,
110
- setActiveStepByIndex
111
- }));
112
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogContentWrapper, {
113
- component: "div",
114
- className: isMobile ? 'mobileStyle' : '',
115
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_launcherLayout.default, {
116
- locale: locale,
117
- blockletMeta: _objectSpread({
118
- title: ' '
119
- }, meta),
120
- pcWidth: "100%",
121
- pcHeight: "100%",
122
- logoUrl: meta && meta.logo && meta.registryUrl ? (0, _util2.getBlockletLogoUrl)({
123
- did: meta.did,
124
- baseUrl: meta.registryUrl,
125
- logoPath: meta.logo
126
- }) : null,
127
- stepTip: t('blocklet.component.add'),
128
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RightContent, {
129
- children: step !== null && step !== void 0 && step.body && typeof step.body === 'function' ? step.body() : step.body
130
- })
131
- })
132
- });
133
- });
134
- StepContent.propTypes = {
135
- meta: _propTypes.default.any,
136
- onStepChange: _propTypes.default.func.isRequired,
137
- isMobile: _propTypes.default.bool.isRequired
138
- };
139
- StepContent.defaultProps = {
140
- meta: null
141
- };
142
- function AddComponent(_ref2) {
143
- var _blocklet$meta2, _blocklet$meta3, _blocklet$meta4, _purchaseRef$current, _purchaseRef$current$, _purchaseRef$current2, _purchaseRef$current3;
24
+ function AddComponent(_ref) {
144
25
  let {
145
26
  blocklet,
146
27
  children
147
- } = _ref2;
28
+ } = _ref;
148
29
  const {
149
- t,
150
- locale
30
+ t
151
31
  } = (0, _context.useLocaleContext)();
152
- const [loading, setLoading] = (0, _react.useState)(false);
153
- const [editingItem, setEditingItem] = (0, _react.useState)(null);
154
- const [error, setError] = (0, _react.useState)('');
155
- const [showDialog, setShowDialog] = (0, _react.useState)('');
156
- const [mountPointHelperText, setMountPointHelperText] = (0, _react.useState)('');
157
- const {
158
- api,
159
- ws: {
160
- useSubscription
161
- },
162
- inService,
163
- info: nodeInfo
164
- } = (0, _node.useNodeContext)();
165
- const {
166
- actions: {
167
- refreshBlocklet: refreshApp
168
- }
169
- } = (0, _blocklet.useBlockletContext)();
170
- const [purchaseData, setPurchaseData] = (0, _react.useState)(null);
171
- const [isWaitingPurchase, setIsWaitingPurchase] = (0, _react.useState)(false);
172
- const initParams = {
173
- bundleDid: '',
174
- componentDid: '',
175
- componentName: '',
176
- pathPrefix: '',
177
- name: '',
178
- title: '',
179
- configsList: [],
180
- configsValue: {},
181
- hasMissRequiredConfigs: false,
182
- hasEnvironmentsStep: false,
183
- hasRequiredEnvironments: false,
184
- requirePurchase: false,
185
- didSpaceCapability: null,
186
- installResultProps: {},
187
- purchaseResultProps: {},
188
- showFromUrlDialog: false
189
- };
190
- const [params, setParams] = (0, _react.useState)(initParams);
191
- const [activeStep, setActiveStep] = (0, _react.useState)(0);
192
- const component = (0, _react.useRef)({});
193
- const stepRef = (0, _react.useRef)({});
194
- const purchaseRef = (0, _react.useRef)({});
32
+ const [showDialog, setShowDialog] = (0, _react.useState)(false);
195
33
  const isMobile = (0, _useMediaQuery.default)(theme => theme.breakpoints.down('md'));
196
34
  const {
197
- meta
198
- } = component.current;
199
- // eslint-disable-next-line no-unused-vars
200
- const {
201
- setActiveStepByIndex
202
- } = stepRef.current || {};
203
- const isServerlessMode = nodeInfo.mode === _constant2.NODE_MODES.SERVERLESS;
204
- const updateParams = obj => setParams(x => _objectSpread(_objectSpread({}, x), obj));
205
- (0, _react.useEffect)(() => {
206
- if (params.pathPrefix) {
207
- const {
208
- errMsg
209
- } = validateInput(_objectSpread(_objectSpread({}, params), {}, {
210
- pathPrefix: params.pathPrefix,
211
- locale
212
- }));
213
- setError(errMsg);
214
- }
215
- }, [params.pathPrefix]); // eslint-disable-line
216
-
217
- (0, _react.useEffect)(() => {
218
- if (activeStep === 0) {
219
- // reset params, when step change to select component
220
- setParams(initParams);
221
- }
222
- }, [activeStep]); // eslint-disable-line
223
-
224
- const getComponentName = () => {
225
- var _component$current;
226
- if (component !== null && component !== void 0 && (_component$current = component.current) !== null && _component$current !== void 0 && _component$current.meta) {
227
- return (0, _util.getDisplayName)(component.current);
228
- }
229
- return '';
230
- };
231
- const setInstallErrorResult = errorMessage => {
232
- const update = _loading => {
233
- updateParams({
234
- installResultProps: {
235
- variant: 'error',
236
- title: getComponentName(),
237
- subTitle: errorMessage,
238
- footer: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
239
- className: "bottom-button",
240
- disabled: _loading,
241
- "data-cy": "retry-install-component",
242
- onClick: async () => {
243
- // set button disabled and show spinner
244
- update(true);
245
- await onInstall(component.current.installInput);
246
- },
247
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
248
- display: "flex",
249
- alignItems: "center",
250
- children: [_loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
251
- size: 16,
252
- style: {
253
- marginRight: 8
254
- }
255
- }), t('common.retry')]
256
- })
257
- })
258
- }
259
- });
260
- };
261
- update();
262
- };
263
- const createBlockletEventHandler = handler => {
264
- return b => {
265
- var _b$meta, _blocklet$meta;
266
- if (((b === null || b === void 0 ? void 0 : (_b$meta = b.meta) === null || _b$meta === void 0 ? void 0 : _b$meta.did) || (b === null || b === void 0 ? void 0 : b.meta)) === (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did)) {
267
- handler(b);
268
- }
269
- };
270
- };
271
- useSubscription(_constant.BlockletEvents.statusChange, createBlockletEventHandler(e => {
272
- switch (e.status) {
273
- case _constant.BlockletStatus.upgrading:
274
- updateParams({
275
- installResultProps: {
276
- variant: 'success',
277
- title: getComponentName(),
278
- subTitle: t('blocklet.component.installSuccessTip')
279
- }
280
- });
281
- break;
282
- default:
283
- }
284
- }), [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta2 = blocklet.meta) === null || _blocklet$meta2 === void 0 ? void 0 : _blocklet$meta2.did]);
285
- useSubscription(_constant.BlockletEvents.downloadFailed, createBlockletEventHandler(() => {
286
- setInstallErrorResult(t('blocklet.component.installComponentError'));
287
- }), [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta3 = blocklet.meta) === null || _blocklet$meta3 === void 0 ? void 0 : _blocklet$meta3.did]);
288
- useSubscription(_constant.BlockletEvents.installFailed, createBlockletEventHandler(() => {
289
- setInstallErrorResult(t('blocklet.component.installComponentError'));
290
- }), [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta4 = blocklet.meta) === null || _blocklet$meta4 === void 0 ? void 0 : _blocklet$meta4.did]);
291
- const onClose = () => {
292
- setLoading(false);
35
+ inService
36
+ } = (0, _node.useNodeContext)();
37
+ const _onClose = () => {
293
38
  setShowDialog(false);
294
- setParams({});
295
- component.current = {};
296
- };
297
- const onInstall = async payload => {
298
- var _component$current2, _component$current3;
299
- const {
300
- pathPrefix: mountPoint,
301
- bundleDid,
302
- title,
303
- componentName = '',
304
- componentDid = ''
305
- } = params;
306
- // eslint-disable-next-line no-shadow
307
- const {
308
- configs = [],
309
- registryUrl,
310
- inStore,
311
- inputUrl
312
- } = ((_component$current2 = component.current) === null || _component$current2 === void 0 ? void 0 : _component$current2.meta) || {};
313
- const downloadTokenList = (_component$current3 = component.current) === null || _component$current3 === void 0 ? void 0 : _component$current3.downloadTokenList;
314
- const url = inStore ? (0, _util2.getBlockletMetaUrl)(registryUrl, bundleDid) : inputUrl;
315
- setLoading(true);
316
- const installInput = _objectSpread(_objectSpread(_objectSpread({
317
- rootDid: blocklet.meta.did,
318
- url,
319
- mountPoint: (0, _urlPathFriendly.default)(mountPoint),
320
- title,
321
- name: componentName,
322
- did: componentDid
323
- }, params.hasEnvironmentsStep && configs.length > 0 ? {
324
- configs: configs.map(item => {
325
- return _objectSpread(_objectSpread({}, item), {}, {
326
- value: params.configsValue[item.key] || ''
327
- });
328
- })
329
- } : {}), downloadTokenList ? {
330
- downloadTokenList
331
- } : {}), payload);
332
- try {
333
- await api.installComponent({
334
- input: installInput
335
- });
336
- if (registryUrl) {
337
- const {
338
- teamDid,
339
- storeList
340
- } = (0, _util2.getStoreList)({
341
- fromBlocklet: inService,
342
- nodeInfo,
343
- blocklet
344
- });
345
- const {
346
- isNew,
347
- decoded
348
- } = (0, _util2.isNewStoreUrl)(registryUrl, storeList);
349
- if (isNew) {
350
- await api.addBlockletStore({
351
- input: {
352
- teamDid,
353
- url: decoded
354
- }
355
- });
356
- }
357
- }
358
- updateParams({
359
- installResultProps: {}
360
- });
361
-
362
- // let app state refresh fast before receive subscribe event
363
- refreshApp({
364
- showError: false,
365
- attachRuntimeInfo: false
366
- });
367
- } catch (err) {
368
- const errMsg = (0, _util2.formatError)(err);
369
- _Toast.default.error(errMsg);
370
- console.error('installComponent error: ', err);
371
- setInstallErrorResult(errMsg);
372
- } finally {
373
- setLoading(false);
374
- component.current.installInput = installInput;
375
- }
376
- };
377
- const validateInput = input => {
378
- // FIXME: validatePathPrefix should be updated
379
- const errMsg = (0, _util3.validatePathPrefix)({
380
- params: _objectSpread(_objectSpread({}, input), {}, {
381
- did: input.bundleDid
382
- }),
383
- blocklets: [blocklet],
384
- // blocklets: component.current?.blocklets?.map(x => ({ meta: x })) || [],
385
- blocklet,
386
- locale
387
- });
388
- return {
389
- errMsg
390
- };
391
- };
392
- const onNext = async payload => {
393
- const {
394
- errMsg
395
- } = validateInput(_objectSpread(_objectSpread({}, params), {}, {
396
- locale
397
- }));
398
- setError(errMsg);
399
-
400
- // the step can complete, install component
401
- if (activeStep === steps.length - 2) {
402
- await onInstall(payload);
403
- }
404
- setActiveStepByIndex(x => x + 1);
405
- };
406
- const _onCancel = () => {
407
- setActiveStepByIndex(x => x - 1);
408
39
  };
409
- const onGeneratePurchaseData = () => {
410
- const {
411
- pathPrefix: mountPoint,
412
- bundleDid,
413
- title,
414
- componentName = '',
415
- componentDid = ''
416
- } = params;
417
-
418
- // eslint-disable-next-line no-shadow
419
- const {
420
- meta = {}
421
- } = component.current || {};
422
- const {
423
- registryUrl,
424
- inStore,
425
- inputUrl
426
- } = meta;
427
- const url = inStore ? (0, _util2.getBlockletMetaUrl)(registryUrl, bundleDid) : inputUrl;
428
- setPurchaseData({
429
- meta,
430
- installOpts: {
431
- type: 'component',
432
- rootDid: blocklet.meta.did,
433
- mountPoint,
434
- url,
435
- title,
436
- name: componentName,
437
- did: componentDid
438
- }
439
- });
440
- };
441
- const onCancelPurchase = errorMessage => {
442
- setIsWaitingPurchase(false);
443
- updateParams({
444
- purchaseResultProps: {
445
- variant: 'error',
446
- title: getComponentName(),
447
- subTitle: errorMessage,
448
- style: {
449
- paddingTop: 120
450
- },
451
- footer: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
452
- className: "bottom-button",
453
- "data-cy": "retry-purchase-component",
454
- onClick: () => {
455
- updateParams({
456
- purchaseResultProps: {}
457
- });
458
- },
459
- children: t('common.retry')
460
- })
461
- }
462
- });
463
- };
464
- const onSuccessPurchase = _ref3 => {
465
- let {
466
- downloadTokenList
467
- } = _ref3;
468
- component.current.downloadTokenList = downloadTokenList;
469
- setIsWaitingPurchase(false);
470
- onNext();
471
- };
472
- const setConfigValue = _ref4 => {
473
- var _blocklet$settings, _meta$environments;
474
- let {
475
- chooseParams = component.current,
476
- componentDid: componentDidValue,
477
- isInit = false
478
- } = _ref4;
479
- // eslint-disable-next-line no-shadow
480
- const {
481
- meta,
482
- registryUrl,
483
- inStore,
484
- inputUrl
485
- } = chooseParams;
486
- const {
487
- did: bundleDid,
488
- title,
489
- name
490
- } = meta;
491
-
492
- // deleted history list
493
- const list = (((_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.children) || []).filter(x => x.status === 'deleted' && x.meta.bundleDid === bundleDid);
494
- const componentDid = componentDidValue || '';
495
- const newConfigs = (_meta$environments = meta.environments) === null || _meta$environments === void 0 ? void 0 : _meta$environments.map(item => {
496
- const {
497
- name: key,
498
- validation
499
- } = item,
500
- rest = _objectWithoutProperties(item, _excluded);
501
- const formatItem = {
502
- // if the blocklet has validation, provide the validation (fix not inStore)
503
- validation: (0, _isNil.default)(validation) ? '' : validation
504
- };
505
- return _objectSpread(_objectSpread({}, rest), {}, {
506
- key
507
- }, formatItem);
508
- });
509
- component.current = _objectSpread(_objectSpread({}, chooseParams), {}, {
510
- meta: _objectSpread(_objectSpread({}, meta), {}, {
511
- // init configs from environments
512
- configs: newConfigs,
513
- registryUrl,
514
- inStore,
515
- inputUrl
516
- })
517
- });
518
- let doc = {};
519
-
520
- // if is init, should update configs
521
- if (isInit) {
522
- const ancestors = [blocklet];
523
-
524
- // component config
525
- const componentSelfConfigs = newConfigs || [];
526
-
527
- // TODO: meta not include children environments/configs before install, waiting for next sprint to design
528
- const componentChildrenConfigs = [];
529
-
530
- // eslint-disable-next-line
531
- // chooseBlocklet?.children?.map(childBlocklet => {
532
- // // eslint-disable-next-line no-shadow
533
- // forEachChildSync(childBlocklet, (b, { ancestors }) => {
534
- // const ancestorDids = ancestors.slice(1).map(x => x.meta.did);
535
-
536
- // componentChildrenConfigs.push(
537
- // (b.configs || []).map(x => ({ ...x, childDid: ancestorDids.concat(b.meta.did) }))
538
- // );
539
- // });
540
-
541
- // return false;
542
- // });
543
-
544
- const componentAllConfigs = (0, _uniqBy.default)((0, _flatten.default)([...componentSelfConfigs, ...componentChildrenConfigs]), 'key').filter(x => !!x.key).sort((a, b) => {
545
- if (a.required && !b.required) {
546
- return -1;
547
- }
548
- if (b.required && !a.required) {
549
- return 1;
550
- }
551
- return 0;
552
- });
553
- const sharedConfigObj = (0, _util.getSharedConfigObj)(ancestors[0], {
554
- configs: componentAllConfigs
555
- });
556
- const configsValue = {};
557
- const configsList = componentAllConfigs.map(item => {
558
- const {
559
- default: defaultValue,
560
- key
561
- } = item,
562
- rest = _objectWithoutProperties(item, _excluded2);
563
- configsValue[key] = sharedConfigObj[key] || defaultValue;
564
- return _objectSpread(_objectSpread({}, rest), {}, {
565
- key,
566
- hidden: !!_constant.BLOCKLET_CONFIGURABLE_KEY[key]
567
- });
568
- });
569
- doc = _objectSpread(_objectSpread({}, doc), {}, {
570
- configsList,
571
- configsValue,
572
- hasMissRequiredConfigs: hasMissRequiredConfigs(configsList, configsValue)
573
- });
574
- }
575
- const hasRootPath = blocklet.children.some(x => x.mountPoint === '/');
576
-
577
- // use deleted history
578
- const config = list.find(x => x.meta.bundleDid === bundleDid);
579
- if (config) {
580
- doc = _objectSpread(_objectSpread({}, doc), {}, {
581
- pathPrefix: config.mountPoint,
582
- title: title || '',
583
- componentName: config.meta.name,
584
- // use history's environments
585
- hasEnvironmentsStep: false
586
- });
587
- } else {
588
- var _component$current$me, _component$current$me2;
589
- doc = _objectSpread(_objectSpread({}, doc), {}, {
590
- pathPrefix: hasRootPath ? "/".concat((0, _urlPathFriendly.default)(title) || (0, _urlPathFriendly.default)(name)) : '/',
591
- title: title || '',
592
- componentName: '',
593
- hasEnvironmentsStep: ((_component$current$me = component.current.meta) === null || _component$current$me === void 0 ? void 0 : (_component$current$me2 = _component$current$me.environments) === null || _component$current$me2 === void 0 ? void 0 : _component$current$me2.length) > 0
594
- });
595
- }
596
-
597
- // eslint-disable-next-line no-shadow
598
- const componentRequirePurchase = requirePurchase(component.current.meta);
599
- const componentDIDSpaceCapability = getDIDSpaceCapability(component.current.meta);
600
- const didSpaceEndpoint = getDIDSpaceEndpoint(blocklet);
601
- updateParams(_objectSpread(_objectSpread({
602
- bundleDid,
603
- componentDid
604
- }, doc), {}, {
605
- hasRequiredEnvironments: hasRequiredEnvironments(component.current.meta),
606
- requirePurchase: componentRequirePurchase,
607
- didSpaceCapability: componentDIDSpaceCapability,
608
- didSpaceEndpoint
609
- }));
610
- if (isInit && componentRequirePurchase) {
611
- onGeneratePurchaseData();
612
- }
613
- };
614
- const steps = [{
615
- key: 'selectComponent',
616
- name: t('blocklet.component.selectComponent'),
617
- body: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
618
- component: "div",
619
- children: [params.showFromUrlDialog && /*#__PURE__*/(0, _jsxRuntime.jsx)(_installFromUrl.default
620
- // if not set defaultUrl, the dialog will always show step 1 when the dialog is opened
621
- // defaultUrl={meta?.inputUrl}
622
- , {
623
- mode: "component",
624
- onCancel: () => {
625
- updateParams({
626
- showFromUrlDialog: false
627
- });
628
- }
629
- // eslint-disable-next-line no-shadow
630
- ,
631
- onSuccess: _ref5 => {
632
- let {
633
- meta,
634
- inputUrl,
635
- inStore,
636
- registryUrl
637
- } = _ref5;
638
- setConfigValue({
639
- chooseParams: {
640
- meta,
641
- inputUrl,
642
- inStore,
643
- registryUrl
644
- },
645
- isInit: true
646
- });
647
- updateParams({
648
- showFromUrlDialog: false
649
- });
650
- onNext();
651
- },
652
- handleText: {
653
- title: t('blocklet.component.addComponentTip.fromUrl'),
654
- confirm: t('blocklet.component.choose')
655
- }
656
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectStore.default, {
657
- extra: !isServerlessMode ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
658
- variant: "text",
659
- color: "primary",
660
- "data-cy": "add-component-from-url",
661
- onClick: () => {
662
- updateParams({
663
- showFromUrlDialog: true
664
- });
665
- },
666
- style: {
667
- padding: '0 2px'
668
- },
669
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
670
- style: {
671
- fontSize: 20,
672
- marginRight: 4
673
- }
674
- }), " ", t('blocklet.component.addComponentTip.fromUrl'), ' ']
675
- }) : null,
676
- loading: loading,
677
- onChange: () => {
678
- setParams({});
679
- component.current = {};
680
- },
681
- children: _ref6 => {
682
- let {
683
- currentRegistry
684
- } = _ref6;
685
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_storeBlockletList.default, {
686
- serverVersion: nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.version,
687
- style: isMobile ? {
688
- // should remove other dom height/margin
689
- height: 'calc(100vh - 56px - 80px - 32px - 40px )'
690
- } : {
691
- height: 'calc(100% - 40px)'
692
- },
693
- storeUrl: currentRegistry.url,
694
- handleButtonClick: chooseParams => {
695
- setConfigValue({
696
- chooseParams: _objectSpread(_objectSpread({}, chooseParams), {}, {
697
- inStore: true // choose from store, must be inStore
698
- }),
699
-
700
- isInit: true
701
- });
702
- },
703
- handleBlockletRender: _ref7 => {
704
- let {
705
- blocklet: blockletItem,
706
- defaultRender
707
- } = _ref7;
708
- const isChosen = (params === null || params === void 0 ? void 0 : params.bundleDid) && (params === null || params === void 0 ? void 0 : params.bundleDid) === (blockletItem === null || blockletItem === void 0 ? void 0 : blockletItem.did);
709
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StoreBlockletItemWrapper, {
710
- children: [isChosen && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
711
- className: "check-container",
712
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Check.default, {
713
- className: "check-icon"
714
- })
715
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
716
- className: isChosen ? 'choose-blocklet' : '',
717
- style: {
718
- marginLeft: 16
719
- },
720
- children: defaultRender
721
- })]
722
- });
723
- },
724
- extraFilter: allBlocklets => {
725
- // only use blocklets that are component
726
- return allBlocklets === null || allBlocklets === void 0 ? void 0 : allBlocklets.filter(x => {
727
- if ((blocklet.children || []).some(y => y.meta.did === x.did)) {
728
- return false;
729
- }
730
- return true;
731
- });
732
- }
733
- });
734
- }
735
- })]
736
- }),
737
- cancel: t('common.cancel'),
738
- confirm: getParamsName(params) ? t('blocklet.component.addNext', {
739
- name: getParamsName(params)
740
- }) : t('common.next'),
741
- onCancel: onClose,
742
- onConfirm: () => {
743
- onNext();
744
- }
745
- }, {
746
- key: 'agreement',
747
- name: t('launchBlocklet.introduction'),
748
- body: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
749
- component: "div",
750
- className: "agreement-wrapper",
751
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
752
- title: t('launchBlocklet.introduction'),
753
- subTitle: t('blocklet.component.addComponentTip.introduction')
754
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_agreement.default, {
755
- meta: meta,
756
- onClickNext: onNext,
757
- handleDescEle: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
758
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
759
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
760
- // eslint-disable-next-line
761
- dangerouslySetInnerHTML: {
762
- __html: t("blocklet.component.addComponentTip.".concat(params.requirePurchase ? 'isPurchase' : 'isFree'), {
763
- name: getComponentName()
764
- })
765
- }
766
- })
767
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
768
- children: t('blocklet.component.addComponentTip.belowInformation')
769
- })]
770
- })
771
- })]
772
- }),
773
- cancel: t('common.pre'),
774
- confirm: t('launchBlocklet.next'),
775
- onCancel: _onCancel,
776
- onConfirm: () => {
777
- setIsWaitingPurchase(false);
778
- onNext();
779
- }
780
- }, meta && params.requirePurchase && {
781
- key: 'purchase',
782
- name: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
783
- children: [t('common.verifyNFT'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_required.default, {})]
784
- }),
785
- body: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
786
- component: "div",
787
- className: "flex-align-center",
788
- style: {
789
- flexDirection: 'column'
790
- },
791
- children: [!(((_purchaseRef$current = purchaseRef.current) === null || _purchaseRef$current === void 0 ? void 0 : (_purchaseRef$current$ = _purchaseRef$current.getCurrentStep) === null || _purchaseRef$current$ === void 0 ? void 0 : _purchaseRef$current$.call(_purchaseRef$current)) === 2 || isWaitingPurchase) && /*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
792
- title: t('common.verifyNFT'),
793
- subTitle: t('blocklet.component.addComponentTip.verifyNFT')
794
- }), !(0, _isEmpty.default)(params.purchaseResultProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
795
- className: "flex-align-center flex-justify-center",
796
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchResultMessage.default, _objectSpread({}, params.purchaseResultProps))
797
- }) : purchaseData && /*#__PURE__*/(0, _jsxRuntime.jsx)(_purchase.ComponentPurchaseSelect, {
798
- ref: purchaseRef,
799
- meta: purchaseData.meta
800
- // if select deleted history, use verify mode
801
- ,
802
- mode: params.componentDid ? 'verify' : 'both',
803
- onCancel: onCancelPurchase,
804
- installOpts: purchaseData.installOpts,
805
- handlePaySuccess: onSuccessPurchase
806
- })]
807
- }),
808
- disabled: ((_purchaseRef$current2 = purchaseRef.current) === null || _purchaseRef$current2 === void 0 ? void 0 : (_purchaseRef$current3 = _purchaseRef$current2.getCurrentStep) === null || _purchaseRef$current3 === void 0 ? void 0 : _purchaseRef$current3.call(_purchaseRef$current2)) === 2 || isWaitingPurchase,
809
- cancel: t('common.pre'),
810
- confirm: t('common.next'),
811
- onConfirm: () => {
812
- if (typeof purchaseRef.current.onNext === 'function') {
813
- purchaseRef.current.onNext();
814
- setIsWaitingPurchase(true);
815
- }
816
- },
817
- onCancel: () => {
818
- _onCancel();
819
- }
820
- }, (0, _util.hasStartEngine)(meta) && {
821
- key: 'config',
822
- name: t('common.config'),
823
- error,
824
- body: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
825
- component: "div",
826
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
827
- title: t('common.config'),
828
- subTitle: t('blocklet.component.addComponentTip.config')
829
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
830
- label: t('blocklet.component.mountPoint'),
831
- autoComplete: "off",
832
- variant: "outlined",
833
- name: "pathPrefix",
834
- inputProps: {
835
- 'data-cy': 'mount-point-input'
836
- },
837
- fullWidth: true,
838
- helperText: mountPointHelperText || t('blocklet.component.mountPointTip'),
839
- style: {
840
- marginBottom: 32
841
- },
842
- margin: "normal",
843
- value: params.pathPrefix,
844
- onChange: e => {
845
- const pathPrefix = e.target.value;
846
- updateParams({
847
- pathPrefix
848
- });
849
- setMountPointHelperText(t('common.slugifyHint', {
850
- value: (0, _util2.formatMountPoint)(pathPrefix)
851
- }));
852
- }
853
- }), !!error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
854
- type: "error",
855
- style: {
856
- width: '100%',
857
- marginTop: 8
858
- },
859
- children: error
860
- })]
861
- }),
862
- cancel: t('common.pre'),
863
- confirm: t('common.next'),
864
- onCancel: _onCancel,
865
- onConfirm: () => {
866
- onNext();
867
- }
868
- }, meta && (params === null || params === void 0 ? void 0 : params.hasEnvironmentsStep) && {
869
- key: 'environment',
870
- name: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
871
- children: [t('common.environment'), " ", params.hasRequiredEnvironments && /*#__PURE__*/(0, _jsxRuntime.jsx)(_required.default, {})]
872
- }),
873
- disabled: !!editingItem || (params === null || params === void 0 ? void 0 : params.hasMissRequiredConfigs),
874
- body: () => {
875
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
876
- component: "div",
877
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
878
- title: t('common.environment'),
879
- subTitle: t('blocklet.component.addComponentTip.environment')
880
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_schemaForm.default, {
881
- style: {
882
- marginTop: -12,
883
- width: '100%'
884
- },
885
- schema: params.configsList,
886
- defaultValue: params.configsValue
887
- // eslint-disable-next-line
888
- ,
889
- onChange: (changeValue, _ref8) => {
890
- let {
891
- action,
892
- currentItem,
893
- allValues
894
- } = _ref8;
895
- if (action === 'confirm') {
896
- updateParams({
897
- hasMissRequiredConfigs: hasMissRequiredConfigs(params.configsList, allValues),
898
- configsValue: allValues
899
- });
900
- }
901
- if (action === 'edit') {
902
- setEditingItem(currentItem);
903
- } else if (['cancel', 'confirm'].includes(action)) {
904
- setEditingItem(null);
905
- }
906
- }
907
- })]
908
- });
909
- },
910
- cancel: t('common.pre'),
911
- confirm: t('common.next'),
912
- onCancel: _onCancel,
913
- onConfirm: onNext
914
- }, meta && (params === null || params === void 0 ? void 0 : params.didSpaceCapability) && {
915
- key: 'didSpace',
916
- name: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
917
- children: [t('blocklet.component.didSpaceConfig'), " ", params.didSpaceCapability === 'required' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_required.default, {})]
918
- }),
919
- disabled: params.didSpaceCapability === 'required' && !params.didSpaceEndpoint,
920
- body: () => {
921
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
922
- component: "div",
923
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
924
- title: t('blocklet.component.didSpaceConfig'),
925
- subTitle: t('blocklet.component.didSpaceConfigTip')
926
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
927
- sx: {
928
- mt: '36px',
929
- '& > div': {
930
- maxWidth: 'unset !important',
931
- '& .MuiAutocomplete-root': {
932
- maxWidth: 'unset !important'
933
- }
934
- }
935
- },
936
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceConnector.default, {
937
- sx: {
938
- '& .MuiFormHelperText-root': {
939
- wordBreak: 'break-all'
940
- }
941
- },
942
- helperText: params.didSpaceEndpoint && t('blocklet.component.didSpaceConnected', {
943
- endpoint: params.didSpaceEndpoint
944
- }),
945
- onConnect: () => {
946
- onNext();
947
- }
948
- })
949
- })]
950
- });
951
- },
952
- cancel: t('common.pre'),
953
- confirm: t('common.next'),
954
- onCancel: _onCancel,
955
- onConfirm: onNext
956
- }, {
957
- key: 'install',
958
- name: t('common.install'),
959
- disabled: false,
960
- loading: false,
961
- body: /*#__PURE__*/(0, _jsxRuntime.jsx)(TypographyWrapper, {
962
- component: "div",
963
- className: "flex-justify-center flex-align-center",
964
- style: {
965
- flexDirection: 'column'
966
- },
967
- children: (0, _isEmpty.default)(params.installResultProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimationWaiter.default, {
968
- message: /*#__PURE__*/(0, _jsxRuntime.jsx)(MessageDiv, {
969
- children: t('blocklet.component.installingCanCloseWindowTip')
970
- }),
971
- increaseSpeed: 0.3,
972
- messageLoop: false
973
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
974
- style: {
975
- marginTop: 120
976
- },
977
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchResultMessage.default, _objectSpread({}, params.installResultProps))
978
- })
979
- }),
980
- confirm: t('common.complete'),
981
- // onCancel: onClose,
982
- onConfirm: () => {
983
- onClose();
984
- // scroll to bottom
985
- setTimeout(() => {
986
- const scrollDom = document.getElementsByClassName('dashboard-main')[0];
987
- if (scrollDom) {
988
- scrollDom.scrollTop = scrollDom.scrollHeight;
989
- }
990
- }, 200);
991
- }
992
- }].filter(item => item);
993
- const step = steps[activeStep] || {};
994
40
  const onMenuItemClick = e => {
995
41
  e.stopPropagation();
996
42
  // eslint-disable-next-line no-unused-expressions
997
43
  setShowDialog(true);
998
44
  };
999
- const isDisabled = () => {
1000
- if (loading || step.error || !params.bundleDid) {
1001
- return true;
1002
- }
1003
- if (activeStep > 0) {
1004
- return !params.pathPrefix;
1005
- }
1006
- return false;
1007
- };
1008
-
1009
- // show close button when step is not the last one
1010
- const showCloseButton = activeStep < steps.length - 1;
1011
45
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1012
46
  children: [typeof children === 'function' ? children({
1013
- loading,
1014
47
  open: onMenuItemClick
1015
48
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
1016
49
  onClick: onMenuItemClick,
1017
50
  className: "component-action",
1018
51
  "data-cy": "action-add-component",
1019
- children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
1020
- size: 16
1021
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
1022
53
  style: {
1023
54
  fontSize: 18,
1024
55
  marginRight: 5
@@ -1043,68 +74,18 @@ function AddComponent(_ref2) {
1043
74
  // eslint-disable-next-line no-unused-vars
1044
75
  ,
1045
76
  onClose: (event, reason) => {
1046
- var _steps$, _steps$$onCancel;
1047
77
  // disable backdropClick
1048
78
  if (reason === 'backdropClick') {
1049
79
  return;
1050
80
  }
1051
- (_steps$ = steps[0]) === null || _steps$ === void 0 ? void 0 : (_steps$$onCancel = _steps$.onCancel) === null || _steps$$onCancel === void 0 ? void 0 : _steps$$onCancel.call(_steps$);
81
+ _onClose();
1052
82
  },
1053
- showCloseButton: showCloseButton,
83
+ showCloseButton: true,
1054
84
  disableEscapeKeyDown: true,
1055
85
  open: true,
1056
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1057
- children: [step.cancel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
1058
- onClick: e => {
1059
- e.stopPropagation();
1060
- step.onCancel();
1061
- },
1062
- disabled: activeStep === steps.length - 2 && loading,
1063
- color: "inherit",
1064
- children: step.cancel || t('common.cancel')
1065
- }), step.confirm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
1066
- onClick: e => {
1067
- e.stopPropagation();
1068
- step.onConfirm();
1069
- },
1070
- color: "primary",
1071
- "data-cy": "submit-confirm-next",
1072
- disabled: loading || (typeof step.disabled === 'boolean' ? step.disabled : isDisabled()),
1073
- variant: "contained",
1074
- autoFocus: true,
1075
- title: step.confirm,
1076
- style: {
1077
- marginLeft: 8,
1078
- overflow: 'hidden',
1079
- textOverflow: 'ellipsis',
1080
- whiteSpace: 'nowrap',
1081
- minWidth: '140px',
1082
- maxWidth: '280px',
1083
- textAlign: 'center'
1084
- },
1085
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
1086
- display: "flex",
1087
- alignItems: "center",
1088
- children: [(typeof step.loading === 'boolean' ? step.loading : loading) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
1089
- style: {
1090
- marginRight: 8
1091
- },
1092
- size: 16
1093
- }), step.confirm]
1094
- })
1095
- })]
1096
- }),
1097
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_step.StepProvider, {
1098
- steps: steps,
1099
- mode: "memory",
1100
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StepContent, {
1101
- ref: stepRef,
1102
- meta: meta,
1103
- isMobile: isMobile,
1104
- onStepChange: newStep => {
1105
- setActiveStep(newStep);
1106
- }
1107
- })
86
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_addComponentCore.default, {
87
+ onClose: _onClose,
88
+ storageKey: inService ? _constants.STORAGE_KEY_STORE_BLOCKLET : _constants.STORAGE_KEY_STORE_SERVER
1108
89
  })
1109
90
  })]
1110
91
  });
@@ -1116,25 +97,4 @@ AddComponent.propTypes = {
1116
97
  AddComponent.defaultProps = {
1117
98
  children: null
1118
99
  };
1119
- const DialogWrapper = (0, _styled.default)(_Dialog.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .MuiDialogContent-root {\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 0;\n }\n\n .MuiDialogActions-root {\n padding: 16px 24px;\n }\n"])));
1120
- const TypographyWrapper = (0, _styled.default)(_Typography.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n"])));
1121
- const RightContent = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n\n .bottom-button {\n min-width: 200px;\n }\n\n // blocklet-select-side\n aside {\n width: 140px;\n }\n"])));
1122
- const isMobileDialogContent = props => {
1123
- if (props.isMobile) {
1124
- return "\n height: calc(100vh - 56px - 64px - 48px);\n ";
1125
- }
1126
- return '';
1127
- };
1128
- const DialogContentWrapper = (0, _styled.default)(_DialogContentText.default)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n\n & .flex-justify-center {\n display: flex;\n justify-content: center;\n }\n\n & .flex-align-center {\n display: flex;\n height: 100%;\n align-items: center;\n ", "\n }\n\n & .agreement-wrapper {\n ", "\n max-height: 60vh;\n .eula-trigger {\n padding-right: 0;\n }\n .next-button {\n display: none;\n }\n }\n\n & .connect {\n background: white;\n }\n"])), _ref9 => {
1129
- let {
1130
- className
1131
- } = _ref9;
1132
- // mobile extra style
1133
- if (className === 'mobileStyle') {
1134
- return "\n height: 100%;\n\n & > div{\n height: 100%;\n }\n .root-header {\n .app-name-content {\n display: none;\n }\n }\n\n\n\n // content-panel\n .root-header + div{\n padding-top: 0;\n position: relative;\n & > div {\n padding-top: 0;\n }\n }\n\n header + div {\n padding-top: 0;\n }\n\n header {\n .header-title {\n margin-left: 0;\n }\n\n .header-title-name {\n max-width: 100% !important;\n }\n }\n ";
1135
- }
1136
- return "\n height: 72vh;\n position: relative;\n .root-header {\n z-index: auto !important;\n position: fixed !important;\n }\n & > div {\n height: 100%;\n width: 100%;\n max-width: 100%;\n & > div {\n max-height: unset !important;\n max-width: 100%;\n & > div {\n // left-panel\n &:first-child {\n padding-top: 0;\n // padding-left: 0;\n width: 25%;\n min-width: 240px;\n & > div:first-child {\n display: none;\n }\n // step\n & > div:last-child {\n // margin-top: 32px;\n margin-top: 0;\n }\n }\n // right-panel\n &:last-child {\n padding-top: 0;\n padding-right: 24px;\n overflow-y: auto;\n .app-content {\n padding: 0 0 24px 0;\n }\n .button-container {\n padding-right: 0;\n }\n }\n }\n }\n }\n\n ";
1137
- }, props => isMobileDialogContent(props), props => isMobileDialogContent(props));
1138
- const PageHeaderWrapper = (0, _styled.default)(_pageHeader.default)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-bottom: 24px;\n"])));
1139
- const StoreBlockletItemWrapper = _styled.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n\n .choose-blocklet {\n background-color: rgb(236, 251, 253);\n border-color: rgb(236, 251, 253);\n border-radius: 8px;\n }\n\n .check-container {\n position: absolute;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n width: 30px;\n height: 30px;\n border-radius: 0 0 8px 0;\n color: ", ";\n overflow: hidden;\n transition: all ease 0.3s;\n &:after {\n position: absolute;\n z-index: 0;\n display: block;\n width: 0;\n height: 0;\n border-top: transparent solid 15px;\n border-left: transparent solid 15px;\n border-bottom: ", " solid 15px;\n border-right: ", " solid 15px;\n transition: all ease 0.1s;\n content: '';\n }\n\n .check-icon {\n position: relative;\n z-index: 2;\n margin: 0 1px 1px 0;\n font-size: 16px;\n transition: all ease 0.2s;\n }\n }\n"])), props => props.theme.palette.common.white, props => props.theme.palette.primary.main, props => props.theme.palette.primary.main);
1140
- const MessageDiv = _styled.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n .msg-before {\n display: inline-block;\n color: #aaa;\n font-size: 14px;\n margin-right: 6px;\n }\n"])), props => props.theme.palette.primary.main);
100
+ const DialogWrapper = (0, _styled.default)(_Dialog.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .MuiDialogContent-root {\n }\n"])));