@abtnode/ux 1.8.35 → 1.8.37

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