@abtnode/ux 1.16.27-beta-f109b207 → 1.16.27-beta-74c4e335
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 +192 -171
- package/lib/blocklet/component/add-component/step-connect.js +9 -3
- package/lib/blocklet/component/related-components-dialog.js +1 -0
- package/lib/blocklet/publish/connect-store-list.js +8 -4
- package/lib/blocklet/publish/create-release.js +199 -119
- package/lib/blocklet/publish/hooks/use-want-to-connect-store.js +21 -0
- package/lib/blocklet/publish/resource.js +81 -43
- package/lib/blocklet/publish/select-components.js +31 -11
- package/lib/blocklet/publish/stop-box.js +35 -0
- package/lib/blocklet/publish/tree.js +48 -41
- 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/blocklet/router/action/add-domain-alias.js +2 -0
- package/lib/blocklet/router/add-domain.js +129 -79
- package/lib/confirm.js +4 -1
- package/lib/hooks/use-promise-window-open.js +31 -0
- package/lib/locales/ar.js +6 -4
- package/lib/locales/de.js +6 -4
- package/lib/locales/en.js +6 -4
- package/lib/locales/es.js +6 -4
- package/lib/locales/fr.js +6 -4
- package/lib/locales/hi.js +6 -4
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +6 -4
- package/lib/locales/ja.js +6 -4
- package/lib/locales/ko.js +6 -4
- package/lib/locales/pt.js +6 -4
- package/lib/locales/ru.js +6 -4
- package/lib/locales/th.js +6 -4
- package/lib/locales/vi.js +6 -4
- package/lib/locales/zh-tw.js +7 -5
- package/lib/locales/zh.js +7 -5
- package/lib/store/item.js +38 -31
- package/package.json +19 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect, lazy, useRef, useCallback, useMemo } from 'react';
|
|
1
|
+
import { useState, useEffect, lazy, useRef, useCallback, useMemo, Suspense } from 'react';
|
|
2
2
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -26,7 +26,7 @@ import Tabs from '@arcblock/ux/lib/Tabs';
|
|
|
26
26
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
27
27
|
import Alert from '@arcblock/ux/lib/Alert';
|
|
28
28
|
import { PROJECT } from '@blocklet/constant';
|
|
29
|
-
import { WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID
|
|
29
|
+
import { WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID } from '@abtnode/constant';
|
|
30
30
|
import BlockletBundleAvatar from '../bundle-avatar';
|
|
31
31
|
import { useNodeContext } from '../../contexts/node';
|
|
32
32
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
@@ -36,8 +36,12 @@ import { formatError } from '../../util';
|
|
|
36
36
|
import Resource, { uploadResource } from './resource';
|
|
37
37
|
import SelectComponents from './select-components';
|
|
38
38
|
import ConnectStoreList from './connect-store-list';
|
|
39
|
-
import { createMessageId, waitGetConnectedByStudio, waitGetConnectedStore } from './wait-connect';
|
|
39
|
+
import { createMessageId, waitGetConnectedByStudio, waitGetConnectedStore } from './utils/wait-connect';
|
|
40
40
|
import ConnectStoreButton from './connect-store-button';
|
|
41
|
+
import uploadImageToProject from './utils/upload-image-to-project';
|
|
42
|
+
import useWantToConnectStore from './hooks/use-want-to-connect-store';
|
|
43
|
+
import usePromiseWindowOpen from '../../hooks/use-promise-window-open';
|
|
44
|
+
import StopBox from './stop-box';
|
|
41
45
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
42
46
|
const allowedFileTypes = ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
|
|
43
47
|
const maxFileSize = 1024 * 1024 * 10; // 10 MB
|
|
@@ -161,9 +165,23 @@ export default function CreateRelease({
|
|
|
161
165
|
const [initialResources, setInitialResources] = useState({});
|
|
162
166
|
const [releaseUsedLast, setReleaseUsedLast] = useState(false);
|
|
163
167
|
const saveSelectedEventsRef = useRef({});
|
|
164
|
-
const [
|
|
165
|
-
const
|
|
166
|
-
const
|
|
168
|
+
const [initLogoUrl, setInitLogoUrl] = useState('');
|
|
169
|
+
const [wantToConnectStore, setWantToConnectStore] = useWantToConnectStore(blocklet);
|
|
170
|
+
const [resourceComponentsMap, _setResourceComponentsMap] = useSetState({});
|
|
171
|
+
const dependentComponentsMode = initUrl?.searchParams.get('dependentComponentsMode');
|
|
172
|
+
const disabledSelectComponents = dependentComponentsMode === 'readonly';
|
|
173
|
+
const setResourceComponentsMap = useCallback(setter => {
|
|
174
|
+
if (disabledSelectComponents) {
|
|
175
|
+
setParams({
|
|
176
|
+
blockletComponents: []
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
_setResourceComponentsMap(setter);
|
|
180
|
+
}, [disabledSelectComponents, _setResourceComponentsMap, setParams]);
|
|
181
|
+
const openWindow = usePromiseWindowOpen({
|
|
182
|
+
onOpen: () => setLoading(true),
|
|
183
|
+
onClose: () => setLoading(false)
|
|
184
|
+
});
|
|
167
185
|
const releaseId = inputReleaseId === 'create' ? params?.lastReleaseId || '' : inputReleaseId;
|
|
168
186
|
const mode = inputReleaseId === 'create' ? 'create' : 'edit';
|
|
169
187
|
const projectType = useMemo(() => params?.blockletComponents?.some(x => x.included) ? 'pack' : 'resource', [params?.blockletComponents]);
|
|
@@ -180,6 +198,18 @@ export default function CreateRelease({
|
|
|
180
198
|
const [tab, setTab] = useState(tabs[0]?.value);
|
|
181
199
|
const isPublished = !releaseUsedLast && release?.status === 'published';
|
|
182
200
|
const readOnly = isPublished;
|
|
201
|
+
const resourceRelateComponents = useMemo(() => {
|
|
202
|
+
const result = {};
|
|
203
|
+
Object.keys(resourceComponentsMap).forEach(key => {
|
|
204
|
+
const item = resourceComponentsMap[key];
|
|
205
|
+
if (item) {
|
|
206
|
+
item.forEach(k => {
|
|
207
|
+
result[k] = true;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return result;
|
|
212
|
+
}, [resourceComponentsMap]);
|
|
183
213
|
const getRelease = async () => {
|
|
184
214
|
try {
|
|
185
215
|
const res = await api.getRelease({
|
|
@@ -279,6 +309,32 @@ export default function CreateRelease({
|
|
|
279
309
|
const _params = {
|
|
280
310
|
...params
|
|
281
311
|
};
|
|
312
|
+
const componentMaps = (blocklet?.children || []).reduce((acc, curr) => {
|
|
313
|
+
acc[curr.meta.did] = true;
|
|
314
|
+
return acc;
|
|
315
|
+
}, {});
|
|
316
|
+
Object.keys(resourceRelateComponents).forEach(blockletDid => {
|
|
317
|
+
if (!componentMaps[blockletDid]) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
let included = false;
|
|
321
|
+
if (!disabledSelectComponents) {
|
|
322
|
+
_params.blockletComponents.forEach(item => {
|
|
323
|
+
if (item.did === blockletDid) {
|
|
324
|
+
item.included = true;
|
|
325
|
+
item.required = true;
|
|
326
|
+
included = true;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (!included) {
|
|
331
|
+
_params.blockletComponents.push({
|
|
332
|
+
did: blockletDid,
|
|
333
|
+
included: true,
|
|
334
|
+
required: true
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
});
|
|
282
338
|
_params.blockletVersion = semver.valid(_params.blockletVersion);
|
|
283
339
|
if (!_params.blockletVersion) {
|
|
284
340
|
Toast.error('Invalid Blocklet Version');
|
|
@@ -287,6 +343,22 @@ export default function CreateRelease({
|
|
|
287
343
|
});
|
|
288
344
|
return;
|
|
289
345
|
}
|
|
346
|
+
if (initLogoUrl) {
|
|
347
|
+
try {
|
|
348
|
+
const filename = await uploadImageToProject({
|
|
349
|
+
did: blocklet.meta.did,
|
|
350
|
+
projectId,
|
|
351
|
+
imageUrl: initLogoUrl
|
|
352
|
+
});
|
|
353
|
+
_params.blockletLogo = filename;
|
|
354
|
+
setParams({
|
|
355
|
+
blockletLogo: filename
|
|
356
|
+
});
|
|
357
|
+
} catch (err) {
|
|
358
|
+
Toast.error(err.message);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
290
362
|
const saveKeys = Object.keys(saveSelectedEventsRef.current);
|
|
291
363
|
if (!saveKeys.length) {
|
|
292
364
|
Toast.error('No resource selected');
|
|
@@ -372,7 +444,7 @@ export default function CreateRelease({
|
|
|
372
444
|
const onOpenConnectByStudio = async param => {
|
|
373
445
|
const timer = setTimeout(() => {
|
|
374
446
|
setLoading(false);
|
|
375
|
-
},
|
|
447
|
+
}, 20000);
|
|
376
448
|
const nextBlockletDid = await waitGetConnectedByStudio(api, param);
|
|
377
449
|
setLoading(false);
|
|
378
450
|
clearTimeout(timer);
|
|
@@ -389,37 +461,42 @@ export default function CreateRelease({
|
|
|
389
461
|
Toast.error(t('blocklet.publish.errorTip.noTitle'));
|
|
390
462
|
return;
|
|
391
463
|
}
|
|
392
|
-
setLoading(true);
|
|
393
464
|
if (!wantToConnectStore) {
|
|
394
465
|
Toast.error('No store found');
|
|
395
466
|
return;
|
|
396
467
|
}
|
|
397
468
|
const messageId = createMessageId();
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
469
|
+
openWindow(async (newWindow, open) => {
|
|
470
|
+
try {
|
|
471
|
+
const res = await api.connectByStudio({
|
|
472
|
+
input: {
|
|
473
|
+
did: blocklet?.meta?.did,
|
|
474
|
+
blockletTitle: params?.blockletTitle,
|
|
475
|
+
storeUrl: wantToConnectStore.url,
|
|
476
|
+
storeId: wantToConnectStore.id,
|
|
477
|
+
storeName: wantToConnectStore.name,
|
|
478
|
+
type: params?.blockletComponents?.length > 0 ? 'pack' : 'resource',
|
|
479
|
+
componentDid,
|
|
480
|
+
messageId,
|
|
481
|
+
tenantScope: initUrl?.searchParams.get('tenantScope') || ''
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
if (!res?.url) {
|
|
485
|
+
Toast.error('failed to connect to store');
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
open(res.url);
|
|
489
|
+
onOpenConnectByStudio({
|
|
490
|
+
did: blocklet?.meta?.did,
|
|
491
|
+
projectId: '',
|
|
492
|
+
messageId
|
|
493
|
+
});
|
|
494
|
+
} catch (err) {
|
|
495
|
+
const error = formatError(err);
|
|
496
|
+
Toast.error(error);
|
|
497
|
+
newWindow.document.write(error);
|
|
498
|
+
setLoading(false);
|
|
414
499
|
}
|
|
415
|
-
window.open(res.url);
|
|
416
|
-
onOpenConnectByStudio({
|
|
417
|
-
did: blocklet?.meta?.did,
|
|
418
|
-
projectId: '',
|
|
419
|
-
messageId
|
|
420
|
-
});
|
|
421
|
-
}).catch(err => {
|
|
422
|
-
Toast.error(formatError(err));
|
|
423
500
|
});
|
|
424
501
|
};
|
|
425
502
|
const handleChangeSelectedComponents = data => {
|
|
@@ -431,10 +508,11 @@ export default function CreateRelease({
|
|
|
431
508
|
getData();
|
|
432
509
|
}, [getData]);
|
|
433
510
|
useEffect(() => {
|
|
434
|
-
if (mode === 'create' && initUrl) {
|
|
511
|
+
if (projectId === UNOWNED_DID && mode === 'create' && initUrl) {
|
|
512
|
+
setInitLogoUrl(initUrl.searchParams.get('logo'));
|
|
435
513
|
setParams({
|
|
436
514
|
blockletTitle: initUrl.searchParams.get('title'),
|
|
437
|
-
blockletLogo: initUrl.searchParams.get('logo'),
|
|
515
|
+
// blockletLogo: initUrl.searchParams.get('logo'),
|
|
438
516
|
blockletDescription: initUrl.searchParams.get('description'),
|
|
439
517
|
blockletIntroduction: initUrl.searchParams.get('introduction'),
|
|
440
518
|
blockletComponents: JSON.parse(initUrl.searchParams.get('components') || '[]'),
|
|
@@ -448,7 +526,7 @@ export default function CreateRelease({
|
|
|
448
526
|
//
|
|
449
527
|
}
|
|
450
528
|
}
|
|
451
|
-
}, [setParams, initUrl, mode]);
|
|
529
|
+
}, [setParams, projectId, initUrl, mode]);
|
|
452
530
|
if (!params && loading) {
|
|
453
531
|
return /*#__PURE__*/_jsx(EmptySpinner, {});
|
|
454
532
|
}
|
|
@@ -459,15 +537,23 @@ export default function CreateRelease({
|
|
|
459
537
|
const uploadScreenshotPrefix = `${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/screenshot/upload`;
|
|
460
538
|
const logoUrl = params?.blockletLogo ? `${uploadLogoPrefix}/${params.blockletLogo}` : `${WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`;
|
|
461
539
|
const screenshotUrls = (params?.blockletScreenshots || []).filter(Boolean).map(x => `${uploadScreenshotPrefix}/${x}`);
|
|
462
|
-
const
|
|
463
|
-
const
|
|
540
|
+
const resourceItem = resourceComponents.find(x => x.meta.did === tab);
|
|
541
|
+
const allResourceComponentsStop = resourceComponents.every(x => x.status !== 'running');
|
|
542
|
+
if (allResourceComponentsStop) {
|
|
543
|
+
return /*#__PURE__*/_jsx(StopBox, {
|
|
544
|
+
children: t('blocklet.publish.allComponentsNotRunning')
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
const resourceContent = resourceItem ? /*#__PURE__*/_jsx(Box, {
|
|
464
548
|
children: /*#__PURE__*/_jsx(Resource, {
|
|
465
549
|
initialResources: initialResources,
|
|
466
550
|
saveSelectedEventsRef: saveSelectedEventsRef,
|
|
551
|
+
setResourceComponentsMap: setResourceComponentsMap,
|
|
467
552
|
error: paramsErrTip.blockletResource,
|
|
468
553
|
app: blocklet,
|
|
469
554
|
readOnly: readOnly,
|
|
470
|
-
component:
|
|
555
|
+
component: resourceItem,
|
|
556
|
+
componentDid: componentDid,
|
|
471
557
|
initUrl: initUrl,
|
|
472
558
|
projectId: projectId === UNOWNED_DID ? '' : projectId,
|
|
473
559
|
releaseUsedLast: releaseUsedLast,
|
|
@@ -552,6 +638,8 @@ export default function CreateRelease({
|
|
|
552
638
|
});
|
|
553
639
|
}
|
|
554
640
|
}
|
|
641
|
+
const resourcesUrlTitle = initUrl?.searchParams.get('resourcesTitle');
|
|
642
|
+
const componentsUrlTitle = initUrl?.searchParams.get('componentsTitle');
|
|
555
643
|
return /*#__PURE__*/_jsxs(Main, {
|
|
556
644
|
...rest,
|
|
557
645
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
@@ -574,35 +662,20 @@ export default function CreateRelease({
|
|
|
574
662
|
})]
|
|
575
663
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
576
664
|
display: "flex",
|
|
577
|
-
children: [!isPublished && /*#__PURE__*/_jsxs(
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
mr: 0.5
|
|
589
|
-
}
|
|
590
|
-
}), t('blocklet.publish.saveDraft')]
|
|
591
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
|
592
|
-
variant: "contained",
|
|
593
|
-
disabled: loading || createLoading,
|
|
594
|
-
style: {
|
|
595
|
-
marginRight: 12
|
|
665
|
+
children: [!isPublished && /*#__PURE__*/_jsxs(Button, {
|
|
666
|
+
variant: "contained",
|
|
667
|
+
disabled: loading || createLoading,
|
|
668
|
+
style: {
|
|
669
|
+
marginRight: 12
|
|
670
|
+
},
|
|
671
|
+
onClick: () => onRelease(PROJECT.RELEASE_STATUS.published),
|
|
672
|
+
children: [createLoading === PROJECT.RELEASE_STATUS.published && /*#__PURE__*/_jsx(Spinner, {
|
|
673
|
+
size: 14,
|
|
674
|
+
sx: {
|
|
675
|
+
mr: 0.5
|
|
596
676
|
},
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
size: 14,
|
|
600
|
-
sx: {
|
|
601
|
-
mr: 0.5
|
|
602
|
-
},
|
|
603
|
-
color: "inherit"
|
|
604
|
-
}), t('common.release')]
|
|
605
|
-
})]
|
|
677
|
+
color: "inherit"
|
|
678
|
+
}), t('common.release')]
|
|
606
679
|
}), isPublished && /*#__PURE__*/_jsxs(_Fragment, {
|
|
607
680
|
children: [installButton, /*#__PURE__*/_jsx(Button, {
|
|
608
681
|
variant: "outlined",
|
|
@@ -848,7 +921,7 @@ export default function CreateRelease({
|
|
|
848
921
|
height: 80
|
|
849
922
|
},
|
|
850
923
|
alt: "Blocklet Logo",
|
|
851
|
-
src: logoUrl,
|
|
924
|
+
src: initLogoUrl || logoUrl,
|
|
852
925
|
onClick: () => !readOnly && uploaderLogoRef.current.open()
|
|
853
926
|
})
|
|
854
927
|
})]
|
|
@@ -902,56 +975,61 @@ export default function CreateRelease({
|
|
|
902
975
|
})]
|
|
903
976
|
})]
|
|
904
977
|
})]
|
|
905
|
-
}), /*#__PURE__*/_jsx(
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
978
|
+
}), /*#__PURE__*/_jsx(Suspense, {
|
|
979
|
+
fallback: /*#__PURE__*/_jsx(EmptySpinner, {}),
|
|
980
|
+
children: /*#__PURE__*/_jsx(UploaderComponent, {
|
|
981
|
+
ref: uploaderLogoRef,
|
|
982
|
+
popup: true,
|
|
983
|
+
onUploadFinish: result => {
|
|
984
|
+
setParams({
|
|
985
|
+
blockletLogo: result.data.filename
|
|
986
|
+
});
|
|
987
|
+
setInitLogoUrl('');
|
|
988
|
+
uploaderLogoRef.current.close();
|
|
989
|
+
},
|
|
990
|
+
plugins: ['ImageEditor'],
|
|
991
|
+
installerProps: {
|
|
992
|
+
disabled: true
|
|
993
|
+
},
|
|
994
|
+
apiPathProps: {
|
|
995
|
+
uploader: uploadLogoPrefix,
|
|
996
|
+
disableMediaKitPrefix: true
|
|
997
|
+
},
|
|
998
|
+
coreProps: {
|
|
999
|
+
restrictions: {
|
|
1000
|
+
allowedFileTypes,
|
|
1001
|
+
maxFileSize,
|
|
1002
|
+
maxNumberOfFiles: 1
|
|
1003
|
+
}
|
|
928
1004
|
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1005
|
+
}, "uploader-logo")
|
|
1006
|
+
}), /*#__PURE__*/_jsx(Suspense, {
|
|
1007
|
+
fallback: /*#__PURE__*/_jsx(EmptySpinner, {}),
|
|
1008
|
+
children: /*#__PURE__*/_jsx(UploaderComponent, {
|
|
1009
|
+
ref: uploaderScreenshotRef,
|
|
1010
|
+
popup: true,
|
|
1011
|
+
onUploadFinish: result => {
|
|
1012
|
+
const blockletScreenshots = params.blockletScreenshots || [];
|
|
1013
|
+
blockletScreenshots.push(result.data?.filename);
|
|
1014
|
+
setParams({
|
|
1015
|
+
blockletScreenshots
|
|
1016
|
+
});
|
|
1017
|
+
uploaderScreenshotRef.current.close();
|
|
1018
|
+
},
|
|
1019
|
+
plugins: ['ImageEditor'],
|
|
1020
|
+
apiPathProps: {
|
|
1021
|
+
uploader: uploadScreenshotPrefix,
|
|
1022
|
+
disableMediaKitPrefix: true
|
|
1023
|
+
},
|
|
1024
|
+
coreProps: {
|
|
1025
|
+
restrictions: {
|
|
1026
|
+
allowedFileTypes,
|
|
1027
|
+
maxFileSize,
|
|
1028
|
+
maxNumberOfFiles: 5 - screenshotUrls.length
|
|
1029
|
+
}
|
|
952
1030
|
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
1031
|
+
}, "uploader-screenshot")
|
|
1032
|
+
})]
|
|
955
1033
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
956
1034
|
display: "flex",
|
|
957
1035
|
mt: 3,
|
|
@@ -960,13 +1038,13 @@ export default function CreateRelease({
|
|
|
960
1038
|
className: "left",
|
|
961
1039
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
962
1040
|
variant: "h3",
|
|
963
|
-
children: t('blocklet.publish.resourceTitle')
|
|
1041
|
+
children: resourcesUrlTitle || t('blocklet.publish.resourceTitle')
|
|
964
1042
|
})
|
|
965
1043
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
966
1044
|
sx: {
|
|
967
1045
|
flex: 1
|
|
968
1046
|
},
|
|
969
|
-
children: [/*#__PURE__*/_jsx(Tabs, {
|
|
1047
|
+
children: [!componentDid && /*#__PURE__*/_jsx(Tabs, {
|
|
970
1048
|
tabs: tabs,
|
|
971
1049
|
current: tab,
|
|
972
1050
|
onChange: onTabChange,
|
|
@@ -986,7 +1064,7 @@ export default function CreateRelease({
|
|
|
986
1064
|
className: "left",
|
|
987
1065
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
988
1066
|
variant: "h3",
|
|
989
|
-
children: t('common.components')
|
|
1067
|
+
children: componentsUrlTitle || t('common.components')
|
|
990
1068
|
})
|
|
991
1069
|
}), /*#__PURE__*/_jsx(Box, {
|
|
992
1070
|
sx: {
|
|
@@ -996,7 +1074,9 @@ export default function CreateRelease({
|
|
|
996
1074
|
disabled: loading || readOnly,
|
|
997
1075
|
app: blocklet,
|
|
998
1076
|
value: params?.blockletComponents || [],
|
|
999
|
-
onChange: handleChangeSelectedComponents
|
|
1077
|
+
onChange: handleChangeSelectedComponents,
|
|
1078
|
+
resourceRelateComponents: resourceRelateComponents,
|
|
1079
|
+
dependentComponentsMode: dependentComponentsMode
|
|
1000
1080
|
})
|
|
1001
1081
|
})]
|
|
1002
1082
|
}), /*#__PURE__*/_jsx(Alert, {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BLOCKLET_STORE } from '@abtnode/constant';
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
const LOCAL_STORAGE_KEY = 'lastWantToConnectStoreId';
|
|
4
|
+
function useWantToConnectStore(blocklet) {
|
|
5
|
+
const [_wantToConnectStore, _setWantToConnectStore] = useState(null);
|
|
6
|
+
const setWantToConnectStore = useCallback(x => {
|
|
7
|
+
_setWantToConnectStore(x);
|
|
8
|
+
localStorage.setItem(LOCAL_STORAGE_KEY, x?.id);
|
|
9
|
+
}, [_setWantToConnectStore]);
|
|
10
|
+
const baseStore = useMemo(() => {
|
|
11
|
+
const lastStoreId = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
12
|
+
const lastStore = lastStoreId ? (blocklet?.settings?.storeList || []).find(x => x.id === lastStoreId) : null;
|
|
13
|
+
if (lastStore) {
|
|
14
|
+
return lastStore;
|
|
15
|
+
}
|
|
16
|
+
return (blocklet?.settings?.storeList || []).find(x => x.id === BLOCKLET_STORE.id);
|
|
17
|
+
}, [blocklet?.settings?.storeList]);
|
|
18
|
+
const wantToConnectStore = _wantToConnectStore || baseStore;
|
|
19
|
+
return [wantToConnectStore, setWantToConnectStore];
|
|
20
|
+
}
|
|
21
|
+
export default useWantToConnectStore;
|