@abtnode/ux 1.16.27-beta-d1555a79 → 1.16.27-beta-595ed831
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/blocklet/audit-logs.js +4 -1
- package/lib/blocklet/component/add-component/add-component-core.js +200 -281
- package/lib/blocklet/component/add-component/step-connect.js +9 -3
- package/lib/blocklet/component/related-components-dialog.js +1 -0
- package/lib/blocklet/component/store-blocklet-list.js +52 -7
- package/lib/blocklet/publish/connect-store-list.js +8 -4
- package/lib/blocklet/publish/create-release.js +145 -72
- package/lib/blocklet/publish/hooks/use-want-to-connect-store.js +21 -0
- package/lib/blocklet/publish/resource.js +73 -41
- package/lib/blocklet/publish/select-components.js +31 -11
- package/lib/blocklet/publish/stop-box.js +35 -0
- package/lib/blocklet/publish/utils/upload-image-to-project.js +73 -0
- package/lib/blocklet/publish/{wait-connect.js → utils/wait-connect.js} +2 -2
- package/lib/hooks/use-promise-window-open.js +31 -0
- package/lib/locales/ar.js +6 -3
- package/lib/locales/de.js +6 -3
- package/lib/locales/en.js +5 -2
- package/lib/locales/es.js +6 -3
- package/lib/locales/fr.js +6 -3
- package/lib/locales/hi.js +6 -3
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +6 -3
- package/lib/locales/ja.js +6 -3
- package/lib/locales/ko.js +6 -3
- package/lib/locales/pt.js +6 -3
- package/lib/locales/ru.js +6 -3
- package/lib/locales/th.js +6 -3
- package/lib/locales/vi.js +6 -3
- package/lib/locales/zh-tw.js +7 -4
- package/lib/locales/zh.js +6 -3
- package/lib/store/item.js +38 -31
- package/package.json +18 -17
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
4
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
5
|
+
import rehypeExternalLinks from 'rehype-external-links';
|
|
5
6
|
import DidAvatar from '@arcblock/did-connect/lib/Avatar';
|
|
6
7
|
import Spinner from '@mui/material/CircularProgress';
|
|
7
8
|
import Empty from '@arcblock/ux/lib/Empty';
|
|
@@ -105,7 +106,9 @@ function AuditLog({
|
|
|
105
106
|
gutterBottom: true,
|
|
106
107
|
children: /*#__PURE__*/_jsx(MarkdownPreview, {
|
|
107
108
|
source: log.content,
|
|
108
|
-
|
|
109
|
+
rehypePlugins: [[rehypeExternalLinks, {
|
|
110
|
+
target: '_blank'
|
|
111
|
+
}]]
|
|
109
112
|
})
|
|
110
113
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
111
114
|
className: "log-meta",
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
5
|
-
import semver from 'semver';
|
|
6
5
|
import { isInServerlessMode } from '@abtnode/util/lib/serverless';
|
|
7
6
|
import Alert from '@arcblock/ux/lib/Alert';
|
|
8
|
-
import { useTheme } from '@arcblock/ux/lib/Theme';
|
|
9
7
|
import AnimationWaiter from '@arcblock/ux/lib/AnimationWaiter';
|
|
10
8
|
import Button from '@arcblock/ux/lib/Button';
|
|
11
9
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
@@ -15,7 +13,6 @@ import ResultMessage from '@blocklet/launcher-layout/lib/launch-result-message';
|
|
|
15
13
|
import PageHeader from '@blocklet/launcher-layout/lib/page-header';
|
|
16
14
|
import styled from '@emotion/styled';
|
|
17
15
|
import CheckIcon from '@mui/icons-material/Check';
|
|
18
|
-
import UpgradeIcon from '@mui/icons-material/Upgrade';
|
|
19
16
|
import AddIcon from '@mui/icons-material/Link';
|
|
20
17
|
import Box from '@mui/material/Box';
|
|
21
18
|
import Spinner from '@mui/material/CircularProgress';
|
|
@@ -104,11 +101,12 @@ export default function AddComponentCore({
|
|
|
104
101
|
storageKey,
|
|
105
102
|
inDialog,
|
|
106
103
|
selectedMeta,
|
|
104
|
+
storeUrl,
|
|
107
105
|
showResourcesSwitch,
|
|
108
106
|
showFromUrl,
|
|
109
|
-
enableRunBackground
|
|
107
|
+
enableRunBackground,
|
|
108
|
+
showCategory
|
|
110
109
|
}) {
|
|
111
|
-
const theme = useTheme();
|
|
112
110
|
const {
|
|
113
111
|
t,
|
|
114
112
|
locale
|
|
@@ -267,6 +265,7 @@ export default function AddComponentCore({
|
|
|
267
265
|
useSubscription(BlockletEvents.installFailed, createBlockletEventHandler(() => {
|
|
268
266
|
setInstallErrorResult(t('blocklet.component.installComponentError'));
|
|
269
267
|
}), [blocklet?.meta?.did]);
|
|
268
|
+
const steps = [];
|
|
270
269
|
const onOver = () => {
|
|
271
270
|
setLoading(false);
|
|
272
271
|
setParams({});
|
|
@@ -386,7 +385,6 @@ export default function AddComponentCore({
|
|
|
386
385
|
setError(errMsg);
|
|
387
386
|
|
|
388
387
|
// the step can complete, install component
|
|
389
|
-
// eslint-disable-next-line no-use-before-define
|
|
390
388
|
if (activeStep === steps.length - 2) {
|
|
391
389
|
await onInstall(payload);
|
|
392
390
|
}
|
|
@@ -497,6 +495,7 @@ export default function AddComponentCore({
|
|
|
497
495
|
});
|
|
498
496
|
component.current = {
|
|
499
497
|
...chooseParams,
|
|
498
|
+
// FIXME: @zhanghan 此处不应该修改 meta 的结构,会导致在不同地方看到的 meta 结果不一样,然后产生误解
|
|
500
499
|
meta: {
|
|
501
500
|
...meta,
|
|
502
501
|
// init configs from environments
|
|
@@ -614,14 +613,14 @@ export default function AddComponentCore({
|
|
|
614
613
|
}
|
|
615
614
|
};
|
|
616
615
|
useEffect(() => {
|
|
617
|
-
if (!selectedMeta || activeStep !== 0) {
|
|
616
|
+
if (!selectedMeta || activeStep !== 0 || !blocklet) {
|
|
618
617
|
return;
|
|
619
618
|
}
|
|
620
619
|
setConfigValue({
|
|
621
620
|
chooseParams: {
|
|
622
621
|
blocklets: [selectedMeta],
|
|
623
622
|
meta: selectedMeta,
|
|
624
|
-
registryUrl: selectedMeta.homepage,
|
|
623
|
+
registryUrl: storeUrl || selectedMeta.homepage,
|
|
625
624
|
inStore: true
|
|
626
625
|
},
|
|
627
626
|
isInit: true
|
|
@@ -632,25 +631,8 @@ export default function AddComponentCore({
|
|
|
632
631
|
onNext();
|
|
633
632
|
|
|
634
633
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
635
|
-
}, [selectedMeta, activeStep]);
|
|
636
|
-
|
|
637
|
-
const exist = (blocklet?.children || []).find(x => x.meta.bundleDid === item.did);
|
|
638
|
-
if (exist) {
|
|
639
|
-
try {
|
|
640
|
-
const currentVersion = exist.meta.version;
|
|
641
|
-
const targetVersion = item.version;
|
|
642
|
-
if (semver.gt(targetVersion, currentVersion)) {
|
|
643
|
-
return 'upgrade';
|
|
644
|
-
}
|
|
645
|
-
} catch {
|
|
646
|
-
// 如果比对版本报错,则还是允许安装
|
|
647
|
-
return 'install';
|
|
648
|
-
}
|
|
649
|
-
return 'disable';
|
|
650
|
-
}
|
|
651
|
-
return 'install';
|
|
652
|
-
};
|
|
653
|
-
const steps = [{
|
|
634
|
+
}, [selectedMeta, activeStep, blocklet]);
|
|
635
|
+
steps.push({
|
|
654
636
|
key: 'selectComponent',
|
|
655
637
|
name: t('blocklet.component.selectComponent'),
|
|
656
638
|
body: /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
@@ -715,7 +697,7 @@ export default function AddComponentCore({
|
|
|
715
697
|
fontSize: 20,
|
|
716
698
|
marginRight: 4
|
|
717
699
|
}
|
|
718
|
-
}),
|
|
700
|
+
}), " ", t('blocklet.component.addComponentTip.fromUrl'), ' ']
|
|
719
701
|
}) : null : null,
|
|
720
702
|
loading: loading,
|
|
721
703
|
onChange: () => {
|
|
@@ -728,6 +710,7 @@ export default function AddComponentCore({
|
|
|
728
710
|
}) => {
|
|
729
711
|
return /*#__PURE__*/_jsx(BlockletList, {
|
|
730
712
|
showResourcesSwitch: showResourcesSwitch,
|
|
713
|
+
showCategory: showCategory,
|
|
731
714
|
serverVersion: nodeInfo?.version,
|
|
732
715
|
style: isMobile ? {
|
|
733
716
|
// should remove other dom height/margin
|
|
@@ -752,36 +735,8 @@ export default function AddComponentCore({
|
|
|
752
735
|
defaultRender
|
|
753
736
|
}) => {
|
|
754
737
|
const isChosen = params?.bundleDid && params?.bundleDid === blockletItem?.did;
|
|
755
|
-
const actionType = getInstallOrUpgrade(blockletItem);
|
|
756
|
-
if (actionType === 'disable') {
|
|
757
|
-
return /*#__PURE__*/_jsxs(StoreBlockletItemWrapper, {
|
|
758
|
-
style: {
|
|
759
|
-
cursor: 'not-allowed',
|
|
760
|
-
backgroundColor: theme.palette.grey['100']
|
|
761
|
-
},
|
|
762
|
-
title: t('blocklet.component.installed'),
|
|
763
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
764
|
-
className: "install-container",
|
|
765
|
-
children: /*#__PURE__*/_jsx(CheckIcon, {
|
|
766
|
-
className: "install-icon"
|
|
767
|
-
})
|
|
768
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
769
|
-
className: "installed-blocklet",
|
|
770
|
-
style: {
|
|
771
|
-
marginLeft: 16,
|
|
772
|
-
pointerEvents: 'none'
|
|
773
|
-
},
|
|
774
|
-
children: defaultRender
|
|
775
|
-
})]
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
738
|
return /*#__PURE__*/_jsxs(StoreBlockletItemWrapper, {
|
|
779
|
-
children: [
|
|
780
|
-
className: "upgrade-container",
|
|
781
|
-
children: /*#__PURE__*/_jsx(UpgradeIcon, {
|
|
782
|
-
className: "upgrade-icon"
|
|
783
|
-
})
|
|
784
|
-
}) : null, isChosen && /*#__PURE__*/_jsx("div", {
|
|
739
|
+
children: [isChosen && /*#__PURE__*/_jsx("div", {
|
|
785
740
|
className: "check-container",
|
|
786
741
|
children: /*#__PURE__*/_jsx(CheckIcon, {
|
|
787
742
|
className: "check-icon"
|
|
@@ -809,10 +764,14 @@ export default function AddComponentCore({
|
|
|
809
764
|
onConfirm: () => {
|
|
810
765
|
onNext();
|
|
811
766
|
}
|
|
812
|
-
}
|
|
767
|
+
});
|
|
768
|
+
steps.push({
|
|
813
769
|
key: 'agreement',
|
|
814
770
|
name: t('launchBlocklet.introduction'),
|
|
815
|
-
body:
|
|
771
|
+
body:
|
|
772
|
+
/*#__PURE__*/
|
|
773
|
+
// TODO: @zhanghan 添加要展示的信息,暂时无法添加,需要修改 launch-layout 里的组件
|
|
774
|
+
_jsxs(TypographyWrapper, {
|
|
816
775
|
component: "div",
|
|
817
776
|
className: "agreement-wrapper",
|
|
818
777
|
children: [/*#__PURE__*/_jsx(PageHeader, {
|
|
@@ -839,187 +798,200 @@ export default function AddComponentCore({
|
|
|
839
798
|
})
|
|
840
799
|
})]
|
|
841
800
|
}),
|
|
842
|
-
cancel: selectedMeta ?
|
|
801
|
+
cancel: selectedMeta ? undefined : t('common.pre'),
|
|
843
802
|
confirm: t('launchBlocklet.next'),
|
|
844
803
|
onCancel: selectedMeta ? onOver : onCancel,
|
|
845
804
|
onConfirm: () => {
|
|
846
805
|
setIsWaitingPurchase(false);
|
|
847
806
|
onNext();
|
|
848
807
|
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
},
|
|
860
|
-
children: [!(purchaseRef.current?.getCurrentStep?.() === 2 || isWaitingPurchase) && /*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
861
|
-
title: t('common.verifyNFT'),
|
|
862
|
-
subTitle: t('blocklet.component.addComponentTip.verifyNFT')
|
|
863
|
-
}), !isEmpty(params.purchaseResultProps) ? /*#__PURE__*/_jsx("div", {
|
|
864
|
-
className: "flex-align-center flex-justify-center",
|
|
865
|
-
children: /*#__PURE__*/_jsx(ResultMessage, {
|
|
866
|
-
...params.purchaseResultProps
|
|
867
|
-
})
|
|
868
|
-
}) : purchaseData && /*#__PURE__*/_jsx(ComponentPurchaseSelect, {
|
|
869
|
-
ref: purchaseRef,
|
|
870
|
-
meta: purchaseData.meta
|
|
871
|
-
// if select deleted history, use verify mode
|
|
872
|
-
,
|
|
873
|
-
mode: params.componentDid ? 'verify' : 'both',
|
|
874
|
-
onCancel: onCancelPurchase,
|
|
875
|
-
installOpts: purchaseData.installOpts,
|
|
876
|
-
handlePaySuccess: onSuccessPurchase
|
|
877
|
-
})]
|
|
878
|
-
}),
|
|
879
|
-
disabled: purchaseRef.current?.getCurrentStep?.() === 2 || isWaitingPurchase,
|
|
880
|
-
cancel: t('common.pre'),
|
|
881
|
-
confirm: t('common.next'),
|
|
882
|
-
onConfirm: () => {
|
|
883
|
-
if (typeof purchaseRef.current.onNext === 'function') {
|
|
884
|
-
purchaseRef.current.onNext();
|
|
885
|
-
setIsWaitingPurchase(true);
|
|
886
|
-
}
|
|
887
|
-
},
|
|
888
|
-
onCancel: () => {
|
|
889
|
-
onCancel();
|
|
890
|
-
}
|
|
891
|
-
}, hasStartEngine(meta) && !alreadyInstalled(meta.did) && {
|
|
892
|
-
key: 'config',
|
|
893
|
-
name: t('common.config'),
|
|
894
|
-
error,
|
|
895
|
-
body: /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
896
|
-
component: "div",
|
|
897
|
-
children: [/*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
898
|
-
title: t('common.config'),
|
|
899
|
-
subTitle: t('blocklet.component.addComponentTip.config')
|
|
900
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
|
901
|
-
label: t('blocklet.component.mountPoint'),
|
|
902
|
-
autoComplete: "off",
|
|
903
|
-
variant: "outlined",
|
|
904
|
-
name: "pathPrefix",
|
|
905
|
-
inputProps: {
|
|
906
|
-
'data-cy': 'mount-point-input'
|
|
907
|
-
},
|
|
908
|
-
fullWidth: true,
|
|
909
|
-
helperText: mountPointHelperText || t('blocklet.component.mountPointTip'),
|
|
808
|
+
});
|
|
809
|
+
if (meta && params.requirePurchase) {
|
|
810
|
+
steps.push({
|
|
811
|
+
key: 'purchase',
|
|
812
|
+
name: /*#__PURE__*/_jsxs(_Fragment, {
|
|
813
|
+
children: [t('common.verifyNFT'), /*#__PURE__*/_jsx(Required, {})]
|
|
814
|
+
}),
|
|
815
|
+
body: /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
816
|
+
component: "div",
|
|
817
|
+
className: "flex-align-center",
|
|
910
818
|
style: {
|
|
911
|
-
|
|
819
|
+
flexDirection: 'column'
|
|
912
820
|
},
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
821
|
+
children: [!(purchaseRef.current?.getCurrentStep?.() === 2 || isWaitingPurchase) && /*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
822
|
+
title: t('common.verifyNFT'),
|
|
823
|
+
subTitle: t('blocklet.component.addComponentTip.verifyNFT')
|
|
824
|
+
}), !isEmpty(params.purchaseResultProps) ? /*#__PURE__*/_jsx("div", {
|
|
825
|
+
className: "flex-align-center flex-justify-center",
|
|
826
|
+
children: /*#__PURE__*/_jsx(ResultMessage, {
|
|
827
|
+
...params.purchaseResultProps
|
|
828
|
+
})
|
|
829
|
+
}) : purchaseData && /*#__PURE__*/_jsx(ComponentPurchaseSelect, {
|
|
830
|
+
ref: purchaseRef,
|
|
831
|
+
meta: purchaseData.meta
|
|
832
|
+
// if select deleted history, use verify mode
|
|
833
|
+
,
|
|
834
|
+
mode: params.componentDid ? 'verify' : 'both',
|
|
835
|
+
onCancel: onCancelPurchase,
|
|
836
|
+
installOpts: purchaseData.installOpts,
|
|
837
|
+
handlePaySuccess: onSuccessPurchase
|
|
838
|
+
})]
|
|
839
|
+
}),
|
|
840
|
+
disabled: purchaseRef.current?.getCurrentStep?.() === 2 || isWaitingPurchase,
|
|
841
|
+
cancel: t('common.pre'),
|
|
842
|
+
confirm: t('common.next'),
|
|
843
|
+
onConfirm: () => {
|
|
844
|
+
if (typeof purchaseRef.current.onNext === 'function') {
|
|
845
|
+
purchaseRef.current.onNext();
|
|
846
|
+
setIsWaitingPurchase(true);
|
|
923
847
|
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
onConfirm: () => {
|
|
937
|
-
onNext();
|
|
938
|
-
}
|
|
939
|
-
}, meta && !alreadyInstalled(meta.did) && params?.hasEnvironmentsStep && {
|
|
940
|
-
key: 'environment',
|
|
941
|
-
name: /*#__PURE__*/_jsxs(_Fragment, {
|
|
942
|
-
children: [t('common.environment'), " ", params.hasRequiredEnvironments && /*#__PURE__*/_jsx(Required, {})]
|
|
943
|
-
}),
|
|
944
|
-
disabled: !!editingItem || params?.hasMissRequiredConfigs,
|
|
945
|
-
body: () => {
|
|
946
|
-
return /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
848
|
+
},
|
|
849
|
+
onCancel: () => {
|
|
850
|
+
onCancel();
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
if (hasStartEngine(meta) && !alreadyInstalled(meta.did)) {
|
|
855
|
+
steps.push({
|
|
856
|
+
key: 'config',
|
|
857
|
+
name: t('common.config'),
|
|
858
|
+
error,
|
|
859
|
+
body: /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
947
860
|
component: "div",
|
|
948
861
|
children: [/*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
949
|
-
title: t('common.
|
|
950
|
-
subTitle: t('blocklet.component.addComponentTip.
|
|
951
|
-
}), /*#__PURE__*/_jsx(
|
|
862
|
+
title: t('common.config'),
|
|
863
|
+
subTitle: t('blocklet.component.addComponentTip.config')
|
|
864
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
865
|
+
label: t('blocklet.component.mountPoint'),
|
|
866
|
+
autoComplete: "off",
|
|
867
|
+
variant: "outlined",
|
|
868
|
+
name: "pathPrefix",
|
|
869
|
+
inputProps: {
|
|
870
|
+
'data-cy': 'mount-point-input'
|
|
871
|
+
},
|
|
872
|
+
fullWidth: true,
|
|
873
|
+
helperText: mountPointHelperText || t('blocklet.component.mountPointTip'),
|
|
952
874
|
style: {
|
|
953
|
-
|
|
954
|
-
width: '100%'
|
|
875
|
+
marginBottom: 32
|
|
955
876
|
},
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
updateParams({
|
|
967
|
-
hasMissRequiredConfigs: hasMissRequiredConfigs(params.configsList, allValues),
|
|
968
|
-
configsValue: allValues
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
if (action === 'edit') {
|
|
972
|
-
setEditingItem(currentItem);
|
|
973
|
-
} else if (['cancel', 'confirm'].includes(action)) {
|
|
974
|
-
setEditingItem(null);
|
|
975
|
-
}
|
|
877
|
+
margin: "normal",
|
|
878
|
+
value: params.pathPrefix,
|
|
879
|
+
onChange: e => {
|
|
880
|
+
const pathPrefix = e.target.value;
|
|
881
|
+
updateParams({
|
|
882
|
+
pathPrefix
|
|
883
|
+
});
|
|
884
|
+
setMountPointHelperText(t('common.slugifyHint', {
|
|
885
|
+
value: formatMountPoint(pathPrefix)
|
|
886
|
+
}));
|
|
976
887
|
}
|
|
888
|
+
}), !!error && /*#__PURE__*/_jsx(Alert, {
|
|
889
|
+
type: "error",
|
|
890
|
+
style: {
|
|
891
|
+
width: '100%',
|
|
892
|
+
marginTop: 8
|
|
893
|
+
},
|
|
894
|
+
children: error
|
|
977
895
|
})]
|
|
978
|
-
})
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
896
|
+
}),
|
|
897
|
+
cancel: t('common.pre'),
|
|
898
|
+
confirm: t('common.next'),
|
|
899
|
+
onCancel,
|
|
900
|
+
onConfirm: () => {
|
|
901
|
+
onNext();
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
if (meta && !alreadyInstalled(meta.did) && params?.hasEnvironmentsStep) {
|
|
906
|
+
steps.push({
|
|
907
|
+
key: 'environment',
|
|
908
|
+
name: /*#__PURE__*/_jsxs(_Fragment, {
|
|
909
|
+
children: [t('common.environment'), " ", params.hasRequiredEnvironments && /*#__PURE__*/_jsx(Required, {})]
|
|
910
|
+
}),
|
|
911
|
+
disabled: !!editingItem || params?.hasMissRequiredConfigs,
|
|
912
|
+
body: () => {
|
|
913
|
+
return /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
993
914
|
component: "div",
|
|
994
915
|
children: [/*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
995
|
-
title: t('
|
|
996
|
-
subTitle: t('blocklet.component.
|
|
997
|
-
}), /*#__PURE__*/_jsx(
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
maxWidth: 'unset !important',
|
|
1002
|
-
'& .MuiAutocomplete-root': {
|
|
1003
|
-
maxWidth: 'unset !important'
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
916
|
+
title: t('common.environment'),
|
|
917
|
+
subTitle: t('blocklet.component.addComponentTip.environment')
|
|
918
|
+
}), /*#__PURE__*/_jsx(SchemaForm, {
|
|
919
|
+
style: {
|
|
920
|
+
marginTop: -12,
|
|
921
|
+
width: '100%'
|
|
1006
922
|
},
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
923
|
+
schema: params.configsList,
|
|
924
|
+
defaultValue: params.configsValue
|
|
925
|
+
// eslint-disable-next-line
|
|
926
|
+
,
|
|
927
|
+
onChange: (changeValue, {
|
|
928
|
+
action,
|
|
929
|
+
currentItem,
|
|
930
|
+
allValues
|
|
931
|
+
}) => {
|
|
932
|
+
if (action === 'confirm') {
|
|
933
|
+
updateParams({
|
|
934
|
+
hasMissRequiredConfigs: hasMissRequiredConfigs(params.configsList, allValues),
|
|
935
|
+
configsValue: allValues
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
if (action === 'edit') {
|
|
939
|
+
setEditingItem(currentItem);
|
|
940
|
+
} else if (['cancel', 'confirm'].includes(action)) {
|
|
941
|
+
setEditingItem(null);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
1014
944
|
})]
|
|
1015
|
-
})
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}
|
|
945
|
+
});
|
|
946
|
+
},
|
|
947
|
+
cancel: t('common.pre'),
|
|
948
|
+
confirm: t('common.next'),
|
|
949
|
+
onCancel,
|
|
950
|
+
onConfirm: onNext
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
if (meta && !alreadyInstalled(meta.did) && params?.didSpaceIsRequiredSetup) {
|
|
954
|
+
steps.push({
|
|
955
|
+
key: 'didSpace',
|
|
956
|
+
name: /*#__PURE__*/_jsxs(_Fragment, {
|
|
957
|
+
children: [t('blocklet.component.didSpaceConfig'), " ", params.didSpaceIsRequiredSetup === 'required' && /*#__PURE__*/_jsx(Required, {})]
|
|
958
|
+
}),
|
|
959
|
+
disabled: params?.didSpaceIsRequiredSetup && !params.didSpaceEndpoint,
|
|
960
|
+
body: () => {
|
|
961
|
+
return /*#__PURE__*/_jsx(ConfigSpaceProvider, {
|
|
962
|
+
children: /*#__PURE__*/_jsxs(TypographyWrapper, {
|
|
963
|
+
component: "div",
|
|
964
|
+
children: [/*#__PURE__*/_jsx(PageHeaderWrapper, {
|
|
965
|
+
title: t('blocklet.component.didSpaceConfig'),
|
|
966
|
+
subTitle: t('blocklet.component.didSpaceConfigTip')
|
|
967
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
968
|
+
sx: {
|
|
969
|
+
mt: '36px',
|
|
970
|
+
'& > div': {
|
|
971
|
+
maxWidth: 'unset !important',
|
|
972
|
+
'& .MuiAutocomplete-root': {
|
|
973
|
+
maxWidth: 'unset !important'
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
children: /*#__PURE__*/_jsx(DidSpace, {
|
|
978
|
+
blockletMeta: component.current.meta,
|
|
979
|
+
onNext: () => {
|
|
980
|
+
onNext();
|
|
981
|
+
},
|
|
982
|
+
onEndpointUpdate: refreshDidSpaceEndpoint
|
|
983
|
+
})
|
|
984
|
+
})]
|
|
985
|
+
})
|
|
986
|
+
});
|
|
987
|
+
},
|
|
988
|
+
cancel: t('common.pre'),
|
|
989
|
+
confirm: t('common.next'),
|
|
990
|
+
onCancel,
|
|
991
|
+
onConfirm: onNext
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
steps.push({
|
|
1023
995
|
key: 'install',
|
|
1024
996
|
name: alreadyInstalled(meta?.did) ? t('common.upgrade') : t('common.install'),
|
|
1025
997
|
disabled: enableRunBackground ? false : isEmpty(params.installResultProps),
|
|
@@ -1061,7 +1033,7 @@ export default function AddComponentCore({
|
|
|
1061
1033
|
}
|
|
1062
1034
|
}, 200);
|
|
1063
1035
|
}
|
|
1064
|
-
}
|
|
1036
|
+
});
|
|
1065
1037
|
const step = steps[activeStep] || {};
|
|
1066
1038
|
const isDisabled = () => {
|
|
1067
1039
|
if (loading || step.error || !params.bundleDid) {
|
|
@@ -1145,18 +1117,21 @@ AddComponentCore.propTypes = {
|
|
|
1145
1117
|
mode: PropTypes.oneOf(['normal', 'embed']),
|
|
1146
1118
|
inDialog: PropTypes.bool,
|
|
1147
1119
|
stores: PropTypes.arrayOf(PropTypes.string),
|
|
1120
|
+
storeUrl: PropTypes.string,
|
|
1148
1121
|
resourceType: PropTypes.string,
|
|
1149
1122
|
resourceDid: PropTypes.string,
|
|
1150
1123
|
storageKey: PropTypes.string,
|
|
1151
1124
|
selectedMeta: PropTypes.object,
|
|
1152
1125
|
showResourcesSwitch: PropTypes.bool,
|
|
1153
1126
|
showFromUrl: PropTypes.bool,
|
|
1154
|
-
enableRunBackground: PropTypes.bool
|
|
1127
|
+
enableRunBackground: PropTypes.bool,
|
|
1128
|
+
showCategory: PropTypes.bool
|
|
1155
1129
|
};
|
|
1156
1130
|
AddComponentCore.defaultProps = {
|
|
1157
1131
|
onClose: () => {},
|
|
1158
1132
|
mode: 'normal',
|
|
1159
1133
|
stores: [],
|
|
1134
|
+
storeUrl: '',
|
|
1160
1135
|
resourceType: '',
|
|
1161
1136
|
resourceDid: '',
|
|
1162
1137
|
storageKey: '',
|
|
@@ -1164,7 +1139,8 @@ AddComponentCore.defaultProps = {
|
|
|
1164
1139
|
selectedMeta: null,
|
|
1165
1140
|
showResourcesSwitch: true,
|
|
1166
1141
|
showFromUrl: true,
|
|
1167
|
-
enableRunBackground: true
|
|
1142
|
+
enableRunBackground: true,
|
|
1143
|
+
showCategory: true
|
|
1168
1144
|
};
|
|
1169
1145
|
const Wrapper = styled(Box)`
|
|
1170
1146
|
.action-bar {
|
|
@@ -1230,63 +1206,6 @@ const StoreBlockletItemWrapper = styled.div`
|
|
|
1230
1206
|
transition: all ease 0.2s;
|
|
1231
1207
|
}
|
|
1232
1208
|
}
|
|
1233
|
-
.install-container {
|
|
1234
|
-
position: absolute;
|
|
1235
|
-
right: 0;
|
|
1236
|
-
bottom: 0;
|
|
1237
|
-
display: flex;
|
|
1238
|
-
justify-content: flex-end;
|
|
1239
|
-
align-items: flex-end;
|
|
1240
|
-
width: 30px;
|
|
1241
|
-
height: 30px;
|
|
1242
|
-
border-radius: 0 0 8px 0;
|
|
1243
|
-
color: ${props => props.theme.palette.common.white};
|
|
1244
|
-
overflow: hidden;
|
|
1245
|
-
transition: all ease 0.3s;
|
|
1246
|
-
&:after {
|
|
1247
|
-
position: absolute;
|
|
1248
|
-
z-index: 0;
|
|
1249
|
-
display: block;
|
|
1250
|
-
width: 0;
|
|
1251
|
-
height: 0;
|
|
1252
|
-
border-top: transparent solid 15px;
|
|
1253
|
-
border-left: transparent solid 15px;
|
|
1254
|
-
border-bottom: ${props => props.theme.palette.grey['300']} solid 15px;
|
|
1255
|
-
border-right: ${props => props.theme.palette.grey['300']} solid 15px;
|
|
1256
|
-
transition: all ease 0.1s;
|
|
1257
|
-
content: '';
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.install-icon {
|
|
1261
|
-
position: relative;
|
|
1262
|
-
z-index: 2;
|
|
1263
|
-
margin: 0 1px 1px 0;
|
|
1264
|
-
font-size: 16px;
|
|
1265
|
-
transition: all ease 0.2s;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
.upgrade-container {
|
|
1269
|
-
position: absolute;
|
|
1270
|
-
right: 6px;
|
|
1271
|
-
top: 0;
|
|
1272
|
-
display: flex;
|
|
1273
|
-
justify-content: flex-end;
|
|
1274
|
-
align-items: flex-end;
|
|
1275
|
-
width: 30px;
|
|
1276
|
-
height: 30px;
|
|
1277
|
-
border-radius: 0 0 8px 0;
|
|
1278
|
-
color: ${props => props.theme.palette.primary.main};
|
|
1279
|
-
overflow: hidden;
|
|
1280
|
-
transition: all ease 0.3s;
|
|
1281
|
-
|
|
1282
|
-
.upgrade-icon {
|
|
1283
|
-
position: relative;
|
|
1284
|
-
z-index: 2;
|
|
1285
|
-
margin: 0 1px 1px 0;
|
|
1286
|
-
font-size: 24px;
|
|
1287
|
-
transition: all ease 0.2s;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
1209
|
`;
|
|
1291
1210
|
const MessageDiv = styled.div`
|
|
1292
1211
|
color: ${props => props.theme.palette.primary.main};
|
|
@@ -36,7 +36,12 @@ const StepContent = /*#__PURE__*/forwardRef(({
|
|
|
36
36
|
component: "div",
|
|
37
37
|
className: isMobile ? 'mobileStyle' : '',
|
|
38
38
|
sx: {
|
|
39
|
-
height: 'calc(100% - 56px)'
|
|
39
|
+
height: 'calc(100% - 56px)',
|
|
40
|
+
'&>div>div>div:first-child': {
|
|
41
|
+
flex: {
|
|
42
|
+
md: 1
|
|
43
|
+
}
|
|
44
|
+
}
|
|
40
45
|
},
|
|
41
46
|
children: /*#__PURE__*/_jsx(Layout, {
|
|
42
47
|
locale: locale,
|
|
@@ -155,8 +160,9 @@ const ContentWrapper = styled(Box)`
|
|
|
155
160
|
// left-panel
|
|
156
161
|
&:first-child {
|
|
157
162
|
padding: 0;
|
|
158
|
-
width:
|
|
159
|
-
min-width:
|
|
163
|
+
width: 20%;
|
|
164
|
+
min-width: 180px;
|
|
165
|
+
|
|
160
166
|
& > div:first-child {
|
|
161
167
|
display: none;
|
|
162
168
|
}
|