@abtnode/ux 1.16.19-beta-710018ca → 1.16.19-beta-ba354e01

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.
Files changed (57) hide show
  1. package/es/blocklet/component/add-component-core.js +49 -36
  2. package/es/blocklet/component/button.js +12 -0
  3. package/es/blocklet/component/did-space/connect-to.js +355 -0
  4. package/es/blocklet/component/did-space/connected.js +42 -0
  5. package/es/blocklet/component/did-space/delete.js +104 -0
  6. package/es/blocklet/component/did-space/disconnect.js +230 -0
  7. package/es/blocklet/component/did-space/index.js +73 -0
  8. package/es/blocklet/component/did-space/item.js +233 -0
  9. package/es/blocklet/component/index.js +3 -3
  10. package/es/blocklet/component/step-actions.js +99 -0
  11. package/es/blocklet/publish/create-project.js +1 -1
  12. package/es/blocklet/publish/create-release.js +39 -20
  13. package/es/blocklet/publish/index.js +15 -2
  14. package/es/blocklet/publish/project-list.js +32 -1
  15. package/es/blocklet/publish/release-list.js +1 -0
  16. package/es/blocklet/publish/resource.js +2 -13
  17. package/es/blocklet/publish/tree.js +4 -0
  18. package/es/blocklet/resource-type.js +34 -0
  19. package/es/blocklet/storage/connect-to.js +11 -15
  20. package/es/contexts/config-space.js +160 -0
  21. package/es/hooks/use-mobile.js +17 -0
  22. package/es/hooks/use-storage-endpoint.js +23 -0
  23. package/es/images.js +48 -0
  24. package/es/locales/en.js +5 -0
  25. package/es/locales/zh.js +5 -0
  26. package/es/util/constants.js +2 -1
  27. package/es/util/index.js +5 -1
  28. package/es/util/spaces.js +66 -5
  29. package/lib/blocklet/component/add-component-core.js +59 -45
  30. package/lib/blocklet/component/button.js +23 -0
  31. package/lib/blocklet/component/did-space/connect-to.js +362 -0
  32. package/lib/blocklet/component/did-space/connected.js +49 -0
  33. package/lib/blocklet/component/did-space/delete.js +111 -0
  34. package/lib/blocklet/component/did-space/disconnect.js +241 -0
  35. package/lib/blocklet/component/did-space/index.js +82 -0
  36. package/lib/blocklet/component/did-space/item.js +197 -0
  37. package/lib/blocklet/component/index.js +3 -3
  38. package/lib/blocklet/component/step-actions.js +63 -0
  39. package/lib/blocklet/publish/create-project.js +1 -1
  40. package/lib/blocklet/publish/create-release.js +39 -19
  41. package/lib/blocklet/publish/index.js +18 -4
  42. package/lib/blocklet/publish/project-list.js +32 -1
  43. package/lib/blocklet/publish/release-list.js +1 -0
  44. package/lib/blocklet/publish/resource.js +1 -12
  45. package/lib/blocklet/publish/tree.js +45 -38
  46. package/lib/blocklet/resource-type.js +51 -0
  47. package/lib/blocklet/storage/connect-to.js +11 -15
  48. package/lib/contexts/config-space.js +169 -0
  49. package/lib/hooks/use-mobile.js +24 -0
  50. package/lib/hooks/use-storage-endpoint.js +28 -0
  51. package/lib/images.js +51 -0
  52. package/lib/locales/en.js +5 -0
  53. package/lib/locales/zh.js +5 -0
  54. package/lib/util/constants.js +4 -2
  55. package/lib/util/index.js +8 -2
  56. package/lib/util/spaces.js +69 -3
  57. package/package.json +11 -7
@@ -0,0 +1,17 @@
1
+ import { useTheme } from '@mui/material/styles';
2
+ import useMediaQuery from '@mui/material/useMediaQuery';
3
+
4
+ /**
5
+ * @description
6
+ * @export
7
+ * @param {{ key: string | import('@mui/material').Breakpoint }} [{ key }={ key: 'md' }]
8
+ * @return {*}
9
+ */
10
+ export default function useMobile({
11
+ key
12
+ } = {
13
+ key: 'sm'
14
+ }) {
15
+ const theme = useTheme();
16
+ return useMediaQuery(theme.breakpoints.down(key));
17
+ }
@@ -0,0 +1,23 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useBlockletContext } from '../contexts/blocklet';
3
+ import { getDIDSpaceEndpoint } from '../util/spaces';
4
+
5
+ /**
6
+ * @description
7
+ * @export
8
+ * @return {{
9
+ * storageEndpoint: string
10
+ * }}
11
+ */
12
+ export default function useStorageEndpoint() {
13
+ const [storageEndpoint, setStorageEndpoint] = useState(null);
14
+ const {
15
+ blocklet
16
+ } = useBlockletContext();
17
+ useEffect(() => {
18
+ setStorageEndpoint(getDIDSpaceEndpoint(blocklet));
19
+ }, [blocklet]);
20
+ return {
21
+ storageEndpoint
22
+ };
23
+ }
package/es/images.js ADDED
@@ -0,0 +1,48 @@
1
+ import PropTypes from 'prop-types';
2
+ import styled from '@emotion/styled';
3
+ import Box from '@mui/material/Box';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export default function Images({
6
+ data,
7
+ ...props
8
+ }) {
9
+ if (!data || !data.length) {
10
+ return null;
11
+ }
12
+ return /*#__PURE__*/_jsx(StyledBox, {
13
+ ...props,
14
+ children: data.map(item => /*#__PURE__*/_jsx("a", {
15
+ href: item.url,
16
+ target: "_blank",
17
+ rel: "noreferrer",
18
+ children: /*#__PURE__*/_jsx("img", {
19
+ src: item.url,
20
+ alt: item.alt || ''
21
+ })
22
+ }, item.url))
23
+ });
24
+ }
25
+ Images.propTypes = {
26
+ data: PropTypes.arrayOf(PropTypes.shape({
27
+ url: PropTypes.string,
28
+ alt: PropTypes.string
29
+ }))
30
+ };
31
+ Images.defaultProps = {
32
+ data: []
33
+ };
34
+ const StyledBox = styled(Box)`
35
+ display: flex;
36
+ justify-content: flex-start;
37
+ flex-wrap: wrap;
38
+ margin-bottom: -12px;
39
+ a {
40
+ display: flex;
41
+ }
42
+ img {
43
+ height: 128px;
44
+ cursor: pointer;
45
+ margin-right: 12px;
46
+ margin-bottom: 12px;
47
+ }
48
+ `;
package/es/locales/en.js CHANGED
@@ -271,6 +271,7 @@ module.exports = {
271
271
  saveSuccess: 'Saved successfully',
272
272
  scheduleFailed: 'schedule failed',
273
273
  scheduleSuccess: 'successfully scheduled',
274
+ scope: 'Scope',
274
275
  screenshot: 'Screenshot',
275
276
  search: 'Search',
276
277
  security: 'Security',
@@ -621,6 +622,8 @@ module.exports = {
621
622
  isInProgress: 'Blocklet is in progress, please wait for it to finish'
622
623
  },
623
624
  publish: {
625
+ createResource: 'Create Resource',
626
+ addResource: 'Add Release',
624
627
  productTitle: 'Product',
625
628
  versionTitle: 'Version',
626
629
  imgTitle: 'Images',
@@ -635,6 +638,8 @@ module.exports = {
635
638
  createRelease: 'Create a new release',
636
639
  deleteReleaseTip: 'The release cannot be recovered after deletion',
637
640
  createBlockletDid: 'Create from DID Wallet',
641
+ createReleaseSuccess: 'Release created successfully',
642
+ saveDraftSuccess: 'Draft saved successfully',
638
643
  connect: {
639
644
  title: 'Create Blocklet DID',
640
645
  scan: 'Scan the QR code below to generate Blocklet DID',
package/es/locales/zh.js CHANGED
@@ -276,6 +276,7 @@ module.exports = {
276
276
  saveSuccess: '保存成功',
277
277
  scheduleFailed: '加入任务队列失败',
278
278
  scheduleSuccess: '成功加入任务队列',
279
+ scope: '范围',
279
280
  screenshot: '截图',
280
281
  search: '搜索',
281
282
  security: '安全',
@@ -628,6 +629,8 @@ module.exports = {
628
629
  isInProgress: '应用正在进行中,请等待完成'
629
630
  },
630
631
  publish: {
632
+ createResource: '创建资源',
633
+ addResource: '添加资源',
631
634
  productTitle: 'Blocklet 详情',
632
635
  versionTitle: '版本信息',
633
636
  imgTitle: '图片资源',
@@ -642,6 +645,8 @@ module.exports = {
642
645
  createRelease: '创建新的发布',
643
646
  deleteReleaseTip: '此发布删除后不可恢复,是否继续?',
644
647
  createBlockletDid: '通过 DID 钱包创建',
648
+ createReleaseSuccess: '发布成功',
649
+ saveDraftSuccess: '保存成功',
645
650
  connect: {
646
651
  title: '创建 Blocklet DID',
647
652
  scan: '扫描下面的二维码来生成 Blocklet DID',
@@ -1,2 +1,3 @@
1
1
  export const STORAGE_KEY_STORE_BLOCKLET = 'blocklet-add-component-registry';
2
- export const STORAGE_KEY_STORE_SERVER = 'server-add-registry';
2
+ export const STORAGE_KEY_STORE_SERVER = 'server-add-registry';
3
+ export const STORAGE_KEY_STORE_RESOURCE = resource => `resource-${resource}-add-registry`;
package/es/util/index.js CHANGED
@@ -615,4 +615,8 @@ export const getSubscriptionURL = async ({
615
615
  };
616
616
  export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
617
617
  export const getSystemDomains = domains => domains.filter(x => x.isProtected);
618
- export const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
618
+ export const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
619
+ const hasRequiredEnvironments = meta => (meta.environments || []).some(x => x.required);
620
+ export const hasRequiredSteps = meta => {
621
+ return !!meta.requirements?.fuels?.length || hasRequiredEnvironments(meta);
622
+ };
package/es/util/spaces.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import isUrl from 'is-url';
2
2
  import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
3
- import { isObject } from 'lodash';
3
+ import { isObject, isString } from 'lodash';
4
4
  import { joinURL } from 'ufo';
5
5
  import { api } from './api';
6
6
 
7
7
  /* eslint-disable import/prefer-default-export */
8
8
 
9
+ /**
10
+ * @typedef {import('../contexts/config-space').SpaceGateway} SpaceGateway
11
+ */
12
+
9
13
  /**
10
14
  * @FIXME 希望之后放在 sdk 中 @jianchao
11
15
  * @description
@@ -82,7 +86,7 @@ export function getSpaceBackupEndpoint(environments) {
82
86
  * @description
83
87
  * @export
84
88
  * @param {string} endpoint
85
- * @return {boolean}
89
+ * @return {string}
86
90
  */
87
91
  export function getSpaceGatewayFromEndpoint(endpoint) {
88
92
  return endpoint?.replace(/\/api\/space\/.+/, '');
@@ -134,7 +138,11 @@ export async function isValidSpaceGatewayUrl(spaceGatewayUrl) {
134
138
  * @param {string} endpoint
135
139
  * @return {Promise<string >}
136
140
  */
137
- export async function getSpaceNameByEndpoint(endpoint) {
141
+ export async function getSpaceNameByEndpoint(endpoint, {
142
+ timeout
143
+ } = {
144
+ timeout: 3000
145
+ }) {
138
146
  try {
139
147
  if (!isUrl(endpoint)) {
140
148
  return '';
@@ -142,7 +150,7 @@ export async function getSpaceNameByEndpoint(endpoint) {
142
150
  const {
143
151
  headers
144
152
  } = await api.head(endpoint, {
145
- timeout: 3000
153
+ timeout
146
154
  });
147
155
  const spaceName = headers['x-space-name'];
148
156
  return spaceName ? decodeURIComponent(spaceName) : '';
@@ -171,4 +179,57 @@ export function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
171
179
  */
172
180
  export const getDIDSpaceEndpoint = blocklet => {
173
181
  return blocklet?.configs?.find(item => item.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value || null;
174
- };
182
+ };
183
+
184
+ /**
185
+ * @description
186
+ * @export
187
+ * @param {string} endpoint
188
+ * @returns {Promise<SpaceGateway>}
189
+ */
190
+ export async function getSpaceGateway(endpoint) {
191
+ /** @type {SpaceGateway} */
192
+ const spaceGateway = {};
193
+ spaceGateway.did = getDIDSpaceDidFromEndpoint(endpoint);
194
+ spaceGateway.name = await getSpaceNameByEndpoint(endpoint);
195
+ spaceGateway.url = getSpaceGatewayFromEndpoint(endpoint);
196
+ spaceGateway.endpoint = endpoint;
197
+ return spaceGateway;
198
+ }
199
+
200
+ /**
201
+ * @description
202
+ * @export
203
+ * @param {string} anyUrl
204
+ * @param {{
205
+ * timeout: number,
206
+ * withSearchParams: true | false,
207
+ * }} options
208
+ * @returns {Promise<string>}
209
+ */
210
+ export async function getSpaceGatewayUrl(anyUrl, options = {
211
+ timeout: 30000,
212
+ withSearchParams: true
213
+ }) {
214
+ if (!isString(anyUrl)) {
215
+ throw new Error(`url(${anyUrl}) must be a string`);
216
+ }
217
+ const url = anyUrl.startsWith('http') ? anyUrl : `https://${anyUrl}`;
218
+ const u = new URL(url);
219
+
220
+ /** @type {{ data: import('@blocklet/sdk').WindowBlocklet }} */
221
+ const {
222
+ data: blockletMeta
223
+ } = await api.get(joinURL(u.origin, '/__blocklet__.js?type=json'), {
224
+ timeout: options.timeout
225
+ });
226
+
227
+ /** @type {string} */
228
+ const mountPoint = blockletMeta.componentMountPoints.findLast(x => x.did === 'z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf')?.mountPoint;
229
+ if (!mountPoint) {
230
+ throw new Error(`MountPoint(${mountPoint}) not found`);
231
+ }
232
+ const didSpacesCoreUrl = joinURL(u.origin, mountPoint);
233
+ const spaceGatewayUrl = options.withSearchParams && u.searchParams.get('spaceDid') ? joinURL(didSpacesCoreUrl, `?spaceDid=${u.searchParams.get('spaceDid')}`) : didSpacesCoreUrl;
234
+ return spaceGatewayUrl;
235
+ }
@@ -43,7 +43,8 @@ var _agreement = _interopRequireDefault(require("../agreement"));
43
43
  var _installFromUrl = _interopRequireDefault(require("../install-from-url"));
44
44
  var _selectStore = _interopRequireDefault(require("./select-store"));
45
45
  var _storeBlockletList = _interopRequireDefault(require("./store-blocklet-list"));
46
- var _spaceConnector = _interopRequireDefault(require("./space-connector"));
46
+ var _didSpace = _interopRequireDefault(require("./did-space"));
47
+ var _configSpace = require("../../contexts/config-space");
47
48
  var _jsxRuntime = require("react/jsx-runtime");
48
49
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
49
50
  const _excluded = ["name", "validation"],
@@ -127,7 +128,7 @@ const StepContent = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
127
128
  component: "div",
128
129
  className: isMobile ? 'mobileStyle' : '',
129
130
  sx: {
130
- height: '100%'
131
+ height: 'calc(100% - 56px)'
131
132
  },
132
133
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_launcherLayout.default, {
133
134
  locale: locale,
@@ -156,12 +157,15 @@ StepContent.propTypes = {
156
157
  StepContent.defaultProps = {
157
158
  meta: null
158
159
  };
159
- const postInstalledMessage = componentDid => {
160
+ const postInstalledMessage = function postInstalledMessage(componentDid) {
161
+ let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
160
162
  // send event to parent window
161
- window.parent.postMessage({
162
- event: 'component.installed',
163
- componentDid
164
- }, '*');
163
+ setTimeout(() => {
164
+ window.parent.postMessage({
165
+ event: 'component.installed',
166
+ componentDid
167
+ }, '*');
168
+ }, timeout);
165
169
  };
166
170
  function AddComponentCore(_ref3) {
167
171
  var _blocklet$meta2, _blocklet$meta3, _blocklet$meta4, _purchaseRef$current, _purchaseRef$current$, _purchaseRef$current2, _purchaseRef$current3;
@@ -170,7 +174,8 @@ function AddComponentCore(_ref3) {
170
174
  mode,
171
175
  stores,
172
176
  resourceType,
173
- storageKey
177
+ storageKey,
178
+ inDialog
174
179
  } = _ref3;
175
180
  const {
176
181
  t,
@@ -250,6 +255,13 @@ function AddComponentCore(_ref3) {
250
255
  }
251
256
  }, [activeStep]); // eslint-disable-line
252
257
 
258
+ const refreshDidSpaceEndpoint = () => {
259
+ var _getDIDSpaceEndpoint;
260
+ const didSpaceEndpoint = (_getDIDSpaceEndpoint = getDIDSpaceEndpoint(blocklet)) !== null && _getDIDSpaceEndpoint !== void 0 ? _getDIDSpaceEndpoint : '';
261
+ updateParams({
262
+ didSpaceEndpoint
263
+ });
264
+ };
253
265
  const getComponentName = () => {
254
266
  var _component$current;
255
267
  if (component !== null && component !== void 0 && (_component$current = component.current) !== null && _component$current !== void 0 && _component$current.meta) {
@@ -312,6 +324,10 @@ function AddComponentCore(_ref3) {
312
324
  break;
313
325
  default:
314
326
  }
327
+ const didSpaceEndpoint = getDIDSpaceEndpoint(blocklet);
328
+ updateParams(p => _objectSpread(_objectSpread({}, p), {}, {
329
+ didSpaceEndpoint
330
+ }));
315
331
  }), [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta2 = blocklet.meta) === null || _blocklet$meta2 === void 0 ? void 0 : _blocklet$meta2.did]);
316
332
  useSubscription(_constant.BlockletEvents.downloadFailed, createBlockletEventHandler(() => {
317
333
  setInstallErrorResult(t('blocklet.component.installComponentError'));
@@ -420,7 +436,7 @@ function AddComponentCore(_ref3) {
420
436
  errMsg
421
437
  };
422
438
  };
423
- const onNext = async payload => {
439
+ const _onNext = async payload => {
424
440
  const {
425
441
  errMsg
426
442
  } = validateInput(_objectSpread(_objectSpread({}, params), {}, {
@@ -499,7 +515,7 @@ function AddComponentCore(_ref3) {
499
515
  } = _ref4;
500
516
  component.current.downloadTokenList = downloadTokenList;
501
517
  setIsWaitingPurchase(false);
502
- onNext();
518
+ _onNext();
503
519
  };
504
520
  const setConfigValue = _ref5 => {
505
521
  var _blocklet$settings, _meta$environments;
@@ -679,7 +695,7 @@ function AddComponentCore(_ref3) {
679
695
  updateParams({
680
696
  showFromUrlDialog: false
681
697
  });
682
- onNext();
698
+ _onNext();
683
699
  },
684
700
  handleText: {
685
701
  title: t('blocklet.component.addComponentTip.fromUrl'),
@@ -768,7 +784,7 @@ function AddComponentCore(_ref3) {
768
784
  }),
769
785
  onCancel: onOver,
770
786
  onConfirm: () => {
771
- onNext();
787
+ _onNext();
772
788
  }
773
789
  }, {
774
790
  key: 'agreement',
@@ -781,7 +797,7 @@ function AddComponentCore(_ref3) {
781
797
  subTitle: t('blocklet.component.addComponentTip.introduction')
782
798
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_agreement.default, {
783
799
  meta: meta,
784
- onClickNext: onNext,
800
+ onClickNext: _onNext,
785
801
  handleDescEle: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
786
802
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
787
803
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -803,7 +819,7 @@ function AddComponentCore(_ref3) {
803
819
  onCancel: _onCancel,
804
820
  onConfirm: () => {
805
821
  setIsWaitingPurchase(false);
806
- onNext();
822
+ _onNext();
807
823
  }
808
824
  }, meta && params.requirePurchase && {
809
825
  key: 'purchase',
@@ -891,7 +907,7 @@ function AddComponentCore(_ref3) {
891
907
  confirm: t('common.next'),
892
908
  onCancel: _onCancel,
893
909
  onConfirm: () => {
894
- onNext();
910
+ _onNext();
895
911
  }
896
912
  }, meta && (params === null || params === void 0 ? void 0 : params.hasEnvironmentsStep) && {
897
913
  key: 'environment',
@@ -938,7 +954,7 @@ function AddComponentCore(_ref3) {
938
954
  cancel: t('common.pre'),
939
955
  confirm: t('common.next'),
940
956
  onCancel: _onCancel,
941
- onConfirm: onNext
957
+ onConfirm: _onNext
942
958
  }, meta && (params === null || params === void 0 ? void 0 : params.didSpaceCapability) && {
943
959
  key: 'didSpace',
944
960
  name: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -946,41 +962,37 @@ function AddComponentCore(_ref3) {
946
962
  }),
947
963
  disabled: params.didSpaceCapability === 'required' && !params.didSpaceEndpoint,
948
964
  body: () => {
949
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
950
- component: "div",
951
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
952
- title: t('blocklet.component.didSpaceConfig'),
953
- subTitle: t('blocklet.component.didSpaceConfigTip')
954
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
955
- sx: {
956
- mt: '36px',
957
- '& > div': {
958
- maxWidth: 'unset !important',
959
- '& .MuiAutocomplete-root': {
960
- maxWidth: 'unset !important'
961
- }
962
- }
963
- },
964
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceConnector.default, {
965
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_configSpace.ConfigSpaceProvider, {
966
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(TypographyWrapper, {
967
+ component: "div",
968
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PageHeaderWrapper, {
969
+ title: t('blocklet.component.didSpaceConfig'),
970
+ subTitle: t('blocklet.component.didSpaceConfigTip')
971
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
965
972
  sx: {
966
- '& .MuiFormHelperText-root': {
967
- wordBreak: 'break-all'
973
+ mt: '36px',
974
+ '& > div': {
975
+ maxWidth: 'unset !important',
976
+ '& .MuiAutocomplete-root': {
977
+ maxWidth: 'unset !important'
978
+ }
968
979
  }
969
980
  },
970
- helperText: params.didSpaceEndpoint && t('blocklet.component.didSpaceConnected', {
971
- endpoint: params.didSpaceEndpoint
972
- }),
973
- onConnect: () => {
974
- onNext();
975
- }
976
- })
977
- })]
981
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didSpace.default, {
982
+ blockletMeta: component.current.meta,
983
+ onNext: () => {
984
+ _onNext();
985
+ },
986
+ onEndpointUpdate: refreshDidSpaceEndpoint
987
+ })
988
+ })]
989
+ })
978
990
  });
979
991
  },
980
992
  cancel: t('common.pre'),
981
993
  confirm: t('common.next'),
982
994
  onCancel: _onCancel,
983
- onConfirm: onNext
995
+ onConfirm: _onNext
984
996
  }, {
985
997
  key: 'install',
986
998
  name: t('common.install'),
@@ -1039,7 +1051,7 @@ function AddComponentCore(_ref3) {
1039
1051
  height: window.innerHeight
1040
1052
  } : {
1041
1053
  width: '100%',
1042
- height: mode === 'embed' ? '100vh' : '72vh'
1054
+ height: inDialog ? '72vh' : '100vh'
1043
1055
  },
1044
1056
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_step.StepProvider, {
1045
1057
  steps: steps,
@@ -1099,6 +1111,7 @@ function AddComponentCore(_ref3) {
1099
1111
  AddComponentCore.propTypes = {
1100
1112
  onClose: _propTypes.default.func,
1101
1113
  mode: _propTypes.default.oneOf(['normal', 'embed']),
1114
+ inDialog: _propTypes.default.bool,
1102
1115
  stores: _propTypes.default.arrayOf(_propTypes.default.string),
1103
1116
  resourceType: _propTypes.default.string,
1104
1117
  storageKey: _propTypes.default.string
@@ -1108,7 +1121,8 @@ AddComponentCore.defaultProps = {
1108
1121
  mode: 'normal',
1109
1122
  stores: [],
1110
1123
  resourceType: '',
1111
- storageKey: ''
1124
+ storageKey: '',
1125
+ inDialog: true
1112
1126
  };
1113
1127
  const Wrapper = (0, _styled.default)(_Box.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .action-bar {\n display: flex;\n justify-content: flex-end;\n position: sticky;\n bottom: 0;\n padding-top: 16px;\n z-index: 100;\n width: 100%;\n background: #fff;\n border-top: 1px solid #eee;\n }\n"])));
1114
1128
  const TypographyWrapper = (0, _styled.default)(_Typography.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n"])));
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = StyledButton;
7
+ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ 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; }
11
+ 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; }
12
+ 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; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14
+ 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); }
15
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
16
+ function StyledButton(_ref) {
17
+ let props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
18
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread({
19
+ className: "bottom-button",
20
+ variant: "contained",
21
+ color: "primary"
22
+ }, props));
23
+ }