@abtnode/ux 1.16.30-beta-958ae719 → 1.16.30-beta-b80c7bcd
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/actions.js +1 -1
- package/lib/blocklet/{storage/auto-check-update.js → auto-check-update.js} +17 -5
- package/lib/blocklet/component/index.js +28 -31
- package/lib/blocklet/notification/push-kit.js +24 -20
- package/lib/blocklet/publish/create-release/connect-store-button.js +1 -1
- package/lib/blocklet/publish/create-release/header.js +57 -105
- package/lib/blocklet/publish/create-release/install-button.js +140 -0
- package/lib/blocklet/storage/auto-backup.js +1 -1
- package/lib/contexts/blocklet-storage.js +1 -9
- package/lib/locales/ar.js +4 -3
- package/lib/locales/de.js +4 -3
- package/lib/locales/en.js +1 -0
- package/lib/locales/es.js +4 -3
- package/lib/locales/fr.js +4 -3
- package/lib/locales/hi.js +4 -3
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +4 -3
- package/lib/locales/ja.js +4 -3
- package/lib/locales/ko.js +4 -3
- package/lib/locales/pt.js +4 -3
- package/lib/locales/ru.js +4 -3
- package/lib/locales/th.js +4 -3
- package/lib/locales/vi.js +4 -3
- package/lib/locales/zh-tw.js +4 -3
- package/lib/locales/zh.js +4 -3
- package/lib/subscription/blocklet.js +4 -3
- package/lib/util/index.js +21 -16
- package/package.json +8 -8
- package/lib/contexts/blocklet-auto-check-update.js +0 -54
- package/lib/hooks/use-auto-backup.js +0 -40
- package/lib/hooks/use-auto-check-update.js +0 -33
package/lib/blocklet/actions.js
CHANGED
|
@@ -75,7 +75,7 @@ export default function BlockletActions({
|
|
|
75
75
|
console.error('get launcher session failed', data.error);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
setDisableStart([LAUNCH_SESSION_STATUS.
|
|
78
|
+
setDisableStart([LAUNCH_SESSION_STATUS.overdue, LAUNCH_SESSION_STATUS.canceled, LAUNCH_SESSION_STATUS.terminated].includes(data?.launcherSession?.status));
|
|
79
79
|
} catch (error) {
|
|
80
80
|
console.error('call getLauncherSession error', error);
|
|
81
81
|
}
|
|
@@ -4,8 +4,9 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
4
4
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Tooltip from '@mui/material/Tooltip';
|
|
7
|
-
import SwitchControl from '
|
|
8
|
-
import {
|
|
7
|
+
import SwitchControl from './component/switch-control';
|
|
8
|
+
import { useBlockletContext } from '../contexts/blocklet';
|
|
9
|
+
import { useNodeContext } from '../contexts/node';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @description
|
|
@@ -23,9 +24,20 @@ function AutoCheckUpdate({
|
|
|
23
24
|
t
|
|
24
25
|
} = useLocaleContext();
|
|
25
26
|
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
api
|
|
28
|
+
} = useNodeContext();
|
|
29
|
+
const {
|
|
30
|
+
blocklet
|
|
31
|
+
} = useBlockletContext();
|
|
32
|
+
const autoCheckUpdate = blocklet?.settings?.autoCheckUpdate;
|
|
33
|
+
const updateAutoCheckUpdate = async value => {
|
|
34
|
+
await api.updateAutoCheckUpdate({
|
|
35
|
+
input: {
|
|
36
|
+
did: blocklet.meta.did,
|
|
37
|
+
autoCheckUpdate: value
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
29
41
|
const configAutoBackup = async () => {
|
|
30
42
|
try {
|
|
31
43
|
const enabled = !autoCheckUpdate?.enabled;
|
|
@@ -23,7 +23,7 @@ import Empty from '@arcblock/ux/lib/Empty';
|
|
|
23
23
|
import { forEachChildSync, isInProgress } from '@blocklet/meta/lib/util';
|
|
24
24
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
25
25
|
import { useDeletingBlockletContext } from '../../contexts/deleting-blocklets';
|
|
26
|
-
import AutoCheckUpdate from '../
|
|
26
|
+
import AutoCheckUpdate from '../auto-check-update';
|
|
27
27
|
import { useNodeContext } from '../../contexts/node';
|
|
28
28
|
import { formatError, sleep, BlockletAdminRoles } from '../../util';
|
|
29
29
|
import Permission from '../../permission';
|
|
@@ -37,7 +37,6 @@ import ComponentCell, { StyledBadge, StyledComponentRow } from './component-cell
|
|
|
37
37
|
import OptionalComponentCell from './optional-component-cell';
|
|
38
38
|
import AddComponentDialog from './add-component/add-component-dialog';
|
|
39
39
|
import Actions from '../../actions';
|
|
40
|
-
import { BlockletAutoCheckUpdateProvider } from '../../contexts/blocklet-auto-check-update';
|
|
41
40
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
42
41
|
export default function BlockletComponent({
|
|
43
42
|
blocklet,
|
|
@@ -249,35 +248,33 @@ export default function BlockletComponent({
|
|
|
249
248
|
children: [components?.length ? `${t('common.components')} (${components.length})` : `${t('common.components')}`, !needMigration && /*#__PURE__*/_jsx(Permission, {
|
|
250
249
|
permission: inService ? '' : 'mutate_blocklets',
|
|
251
250
|
role: inService ? BlockletAdminRoles : [],
|
|
252
|
-
children: /*#__PURE__*/_jsx(
|
|
253
|
-
children: /*#__PURE__*/_jsx(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}), t('blocklet.component.checkUpdateTitle')]
|
|
280
|
-
})
|
|
251
|
+
children: /*#__PURE__*/_jsx(AutoCheckUpdate, {
|
|
252
|
+
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
253
|
+
top: 1.2,
|
|
254
|
+
right: 0.4,
|
|
255
|
+
color: "error",
|
|
256
|
+
badgeContent: "",
|
|
257
|
+
variant: "dot",
|
|
258
|
+
invisible: !showUpdateDot,
|
|
259
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
260
|
+
disabled: loading || isInProgress(blocklet.status),
|
|
261
|
+
color: "secondary",
|
|
262
|
+
onClick: () => {
|
|
263
|
+
checkForUpdates();
|
|
264
|
+
},
|
|
265
|
+
"data-cy": "check-for-updates",
|
|
266
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
267
|
+
ml: 0.5,
|
|
268
|
+
mr: 0.5,
|
|
269
|
+
display: "flex",
|
|
270
|
+
children: loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
271
|
+
size: 16
|
|
272
|
+
}) : /*#__PURE__*/_jsx(UpdateIcon, {
|
|
273
|
+
style: {
|
|
274
|
+
fontSize: '1em'
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
}), t('blocklet.component.checkUpdateTitle')]
|
|
281
278
|
})
|
|
282
279
|
})
|
|
283
280
|
})
|
|
@@ -84,28 +84,30 @@ function NotificationPushKit() {
|
|
|
84
84
|
await onSubmit(data, event, false);
|
|
85
85
|
}
|
|
86
86
|
const appUrl = (blocklet?.configs || []).find(x => x.key === 'BLOCKLET_APP_URL')?.value;
|
|
87
|
+
const logo = withQuery(joinURL(appUrl, '/.well-known/service/blocklet/logo'), {
|
|
88
|
+
v: blocklet?.meta?.version,
|
|
89
|
+
t: new Date(blocklet?.updatedAt || 0).getTime()
|
|
90
|
+
});
|
|
91
|
+
const notification = {
|
|
92
|
+
type: 'passthrough',
|
|
93
|
+
passthroughType: 'messageStatus',
|
|
94
|
+
data: {
|
|
95
|
+
message: {
|
|
96
|
+
title: 'Test push-kit notification',
|
|
97
|
+
body: 'This is message from push-kit config test',
|
|
98
|
+
sender: {
|
|
99
|
+
did: blocklet?.appDid,
|
|
100
|
+
fullName: blocklet?.meta?.title,
|
|
101
|
+
avatar: logo
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
87
106
|
await api.sendPush({
|
|
88
107
|
input: {
|
|
89
108
|
did,
|
|
90
109
|
receiver: pageState.testReceiver,
|
|
91
|
-
notification: JSON.stringify(
|
|
92
|
-
type: 'passthrough',
|
|
93
|
-
passthroughType: 'messageStatus',
|
|
94
|
-
data: {
|
|
95
|
-
message: {
|
|
96
|
-
title: 'Test push-kit notification',
|
|
97
|
-
body: 'This is message from push-kit config test',
|
|
98
|
-
sender: {
|
|
99
|
-
did: blocklet?.appDid,
|
|
100
|
-
fullName: blocklet?.meta?.title,
|
|
101
|
-
avatar: withQuery(joinURL(appUrl, '/.well-known/service/blocklet/logo'), {
|
|
102
|
-
v: blocklet?.meta?.version,
|
|
103
|
-
t: new Date(blocklet?.updatedAt || 0).getTime()
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
})
|
|
110
|
+
notification: JSON.stringify(notification)
|
|
109
111
|
}
|
|
110
112
|
});
|
|
111
113
|
Toast.success(t('notification.pushKit.testSuccess'));
|
|
@@ -114,7 +116,8 @@ function NotificationPushKit() {
|
|
|
114
116
|
}
|
|
115
117
|
});
|
|
116
118
|
const showTestEmailModal = useMemoizedFn((data, event) => {
|
|
117
|
-
|
|
119
|
+
// 保持展示上一次的数据,不做重置
|
|
120
|
+
// pageState.testReceiver = '';
|
|
118
121
|
pageState.testReceiverError = '';
|
|
119
122
|
confirmApi.open({
|
|
120
123
|
title: t('notification.pushKit.testSend'),
|
|
@@ -122,7 +125,8 @@ function NotificationPushKit() {
|
|
|
122
125
|
content: () => {
|
|
123
126
|
return /*#__PURE__*/_jsx(Box, {
|
|
124
127
|
sx: {
|
|
125
|
-
width: '
|
|
128
|
+
width: '450px',
|
|
129
|
+
maxWidth: '100%'
|
|
126
130
|
},
|
|
127
131
|
children: /*#__PURE__*/_jsx(TextField, {
|
|
128
132
|
sx: {
|
|
@@ -6,12 +6,12 @@ import { PROJECT } from '@blocklet/constant';
|
|
|
6
6
|
import styled from '@emotion/styled';
|
|
7
7
|
import { Icon } from '@iconify/react';
|
|
8
8
|
import CloudUploadRoundedIcon from '@mui/icons-material/CloudUploadRounded';
|
|
9
|
-
import { Box, Breadcrumbs, Button, ButtonGroup,
|
|
9
|
+
import { Box, Breadcrumbs, Button, ButtonGroup, Dialog as MaterialDialog, Typography, useMediaQuery } from '@mui/material';
|
|
10
10
|
import Spinner from '@mui/material/CircularProgress';
|
|
11
11
|
import pick from 'lodash/pick';
|
|
12
12
|
import pAll from 'p-all';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import { useState } from 'react';
|
|
14
|
+
import { useState, useMemo } from 'react';
|
|
15
15
|
import { Link, useNavigate } from 'react-router-dom';
|
|
16
16
|
import semver from 'semver';
|
|
17
17
|
import { joinURL } from 'ufo';
|
|
@@ -27,6 +27,7 @@ import ConnectStoreList from './connect-store-list';
|
|
|
27
27
|
import ProjectSetting from './project-setting';
|
|
28
28
|
import { uploadResource } from './resource-select';
|
|
29
29
|
import UploadedToast from './uploaded-toast';
|
|
30
|
+
import InstallButton from './install-button';
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
31
32
|
const serverEndpoint = window.env?.serverEndpoint;
|
|
32
33
|
function Header({
|
|
@@ -66,7 +67,15 @@ function Header({
|
|
|
66
67
|
const [showSetting, setShowSetting] = useState(false);
|
|
67
68
|
const [installResourceTip, setInstallResourceTip] = useState();
|
|
68
69
|
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
69
|
-
const releaseType =
|
|
70
|
+
const releaseType = useMemo(() => {
|
|
71
|
+
if (params?.blockletComponents?.length > 0) {
|
|
72
|
+
const res = params?.blockletComponents.find(x => {
|
|
73
|
+
return x.included;
|
|
74
|
+
});
|
|
75
|
+
return res ? 'resource' : 'pack';
|
|
76
|
+
}
|
|
77
|
+
return 'resource';
|
|
78
|
+
}, [params?.blockletComponents]);
|
|
70
79
|
const onPublish = () => {
|
|
71
80
|
window.parent.postMessage({
|
|
72
81
|
event: 'studioDialog.uploaded',
|
|
@@ -249,97 +258,12 @@ function Header({
|
|
|
249
258
|
const handleShowSetting = () => {
|
|
250
259
|
setShowSetting(true);
|
|
251
260
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
url.searchParams.set('blocklet_meta_url', blockletMetaUrl);
|
|
259
|
-
installButton = isMobile ? /*#__PURE__*/_jsx(IconButton, {
|
|
260
|
-
component: "a",
|
|
261
|
-
disabled: loading,
|
|
262
|
-
href: url.href,
|
|
263
|
-
target: "_blank",
|
|
264
|
-
rel: "noreferrer",
|
|
265
|
-
color: "primary",
|
|
266
|
-
sx: {
|
|
267
|
-
mr: 1
|
|
268
|
-
},
|
|
269
|
-
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
270
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
271
|
-
icon: "ic:baseline-install-desktop"
|
|
272
|
-
})
|
|
273
|
-
}) : /*#__PURE__*/_jsx(Button, {
|
|
274
|
-
href: url.href,
|
|
275
|
-
disabled: loading,
|
|
276
|
-
target: "_blank",
|
|
277
|
-
rel: "noreferrer",
|
|
278
|
-
variant: "outlined",
|
|
279
|
-
sx: {
|
|
280
|
-
mr: 1
|
|
281
|
-
},
|
|
282
|
-
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
283
|
-
children: t('common.install')
|
|
284
|
-
});
|
|
285
|
-
} else {
|
|
286
|
-
installButton = /*#__PURE__*/_jsxs(_Fragment, {
|
|
287
|
-
children: [isMobile ? /*#__PURE__*/_jsx(IconButton, {
|
|
288
|
-
disabled: loading,
|
|
289
|
-
color: "primary",
|
|
290
|
-
sx: {
|
|
291
|
-
mr: 1
|
|
292
|
-
},
|
|
293
|
-
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
294
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
295
|
-
icon: "ic:baseline-install-desktop"
|
|
296
|
-
})
|
|
297
|
-
}) : /*#__PURE__*/_jsx(Button, {
|
|
298
|
-
disabled: loading,
|
|
299
|
-
variant: "outlined",
|
|
300
|
-
sx: {
|
|
301
|
-
mr: 1
|
|
302
|
-
},
|
|
303
|
-
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
304
|
-
children: t('blocklet.publish.copyInstallUrl')
|
|
305
|
-
}), /*#__PURE__*/_jsx(MaterialDialog, {
|
|
306
|
-
fullWidth: true,
|
|
307
|
-
maxWidth: "sm",
|
|
308
|
-
open: installResourceTip,
|
|
309
|
-
onClose: () => setInstallResourceTip(''),
|
|
310
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
311
|
-
sx: {
|
|
312
|
-
py: 5,
|
|
313
|
-
px: 4,
|
|
314
|
-
wordBreak: 'break-all'
|
|
315
|
-
},
|
|
316
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
317
|
-
variant: "h6",
|
|
318
|
-
sx: {
|
|
319
|
-
mb: 2
|
|
320
|
-
},
|
|
321
|
-
children: t('blocklet.publish.installResourceTip')
|
|
322
|
-
}), /*#__PURE__*/_jsx(ClickToCopy, {
|
|
323
|
-
children: installResourceTip
|
|
324
|
-
}), /*#__PURE__*/_jsxs(Typography, {
|
|
325
|
-
sx: {
|
|
326
|
-
mt: 2
|
|
327
|
-
},
|
|
328
|
-
children: [t('blocklet.publish.installResourceTip2'), /*#__PURE__*/_jsx("a", {
|
|
329
|
-
style: {
|
|
330
|
-
marginLeft: 4
|
|
331
|
-
},
|
|
332
|
-
href: "https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",
|
|
333
|
-
target: "_blank",
|
|
334
|
-
rel: "noreferrer",
|
|
335
|
-
children: t('blocklet.publish.installResourceHelp')
|
|
336
|
-
})]
|
|
337
|
-
})]
|
|
338
|
-
})
|
|
339
|
-
})]
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
}
|
|
261
|
+
const blockletMetaUrl = joinURL(serverEndpoint, `/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/release/blocklet.json`);
|
|
262
|
+
const url = new URL(serverEndpoint);
|
|
263
|
+
url.pathname = joinURL(url.pathname, '/launch-blocklet/agreement');
|
|
264
|
+
url.searchParams.set('blocklet_meta_url', blockletMetaUrl);
|
|
265
|
+
const installUrl = url.href;
|
|
266
|
+
const handleSetTip = () => setInstallResourceTip(blockletMetaUrl);
|
|
343
267
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
344
268
|
children: [/*#__PURE__*/_jsx(Content, {
|
|
345
269
|
className: "sticky-header",
|
|
@@ -393,20 +317,44 @@ function Header({
|
|
|
393
317
|
})
|
|
394
318
|
})]
|
|
395
319
|
}), isPublished && /*#__PURE__*/_jsxs(_Fragment, {
|
|
396
|
-
children: [
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
320
|
+
children: [/*#__PURE__*/_jsx(MaterialDialog, {
|
|
321
|
+
fullWidth: true,
|
|
322
|
+
maxWidth: "sm",
|
|
323
|
+
open: installResourceTip,
|
|
324
|
+
onClose: () => setInstallResourceTip(''),
|
|
325
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
326
|
+
sx: {
|
|
327
|
+
py: 5,
|
|
328
|
+
px: 4,
|
|
329
|
+
wordBreak: 'break-all'
|
|
330
|
+
},
|
|
331
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
332
|
+
variant: "h6",
|
|
333
|
+
sx: {
|
|
334
|
+
mb: 2
|
|
335
|
+
},
|
|
336
|
+
children: t('blocklet.publish.installResourceTip')
|
|
337
|
+
}), /*#__PURE__*/_jsx(ClickToCopy, {
|
|
338
|
+
children: installResourceTip
|
|
339
|
+
}), /*#__PURE__*/_jsxs(Typography, {
|
|
340
|
+
sx: {
|
|
341
|
+
mt: 2
|
|
342
|
+
},
|
|
343
|
+
children: [t('blocklet.publish.installResourceTip2'), /*#__PURE__*/_jsx("a", {
|
|
344
|
+
style: {
|
|
345
|
+
marginLeft: 4
|
|
346
|
+
},
|
|
347
|
+
href: "https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",
|
|
348
|
+
target: "_blank",
|
|
349
|
+
rel: "noreferrer",
|
|
350
|
+
children: t('blocklet.publish.installResourceHelp')
|
|
351
|
+
})]
|
|
352
|
+
})]
|
|
353
|
+
})
|
|
405
354
|
}), /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
406
355
|
disabled: loading,
|
|
407
356
|
variant: "contained",
|
|
408
357
|
children: [/*#__PURE__*/_jsxs(Button, {
|
|
409
|
-
variant: "contained",
|
|
410
358
|
onClick: () => setShowStoreDialog(true),
|
|
411
359
|
children: [loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
412
360
|
size: 14,
|
|
@@ -420,8 +368,12 @@ function Header({
|
|
|
420
368
|
mr: 1
|
|
421
369
|
}
|
|
422
370
|
}), isMobile ? t('common.upload') : t('blocklet.publish.connectOrUpload')]
|
|
371
|
+
}), /*#__PURE__*/_jsx(InstallButton, {
|
|
372
|
+
isPack: releaseType === 'pack',
|
|
373
|
+
downloadUrl: joinURL(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/download/${(release.files || [])[0]}`),
|
|
374
|
+
installUrl: installUrl,
|
|
375
|
+
handleSetTip: handleSetTip
|
|
423
376
|
}), /*#__PURE__*/_jsx(Button, {
|
|
424
|
-
variant: "contained",
|
|
425
377
|
onClick: handleShowSetting,
|
|
426
378
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
427
379
|
icon: "mage:settings-fill",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { Box, Button, ClickAwayListener, Grow, MenuItem, MenuList, Paper, Popper, Typography } from '@mui/material';
|
|
3
|
+
import { Icon } from '@iconify/react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useRef, useState } from 'react';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
export default function InstallButton({
|
|
8
|
+
downloadUrl,
|
|
9
|
+
installUrl,
|
|
10
|
+
handleSetTip,
|
|
11
|
+
isPack,
|
|
12
|
+
disabled
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
t
|
|
16
|
+
} = useLocaleContext();
|
|
17
|
+
const [open, setOpen] = useState(false);
|
|
18
|
+
const anchorRef = useRef(null);
|
|
19
|
+
const handleToggle = () => {
|
|
20
|
+
setOpen(!open);
|
|
21
|
+
};
|
|
22
|
+
const handleClose = event => {
|
|
23
|
+
if (anchorRef.current && anchorRef.current.contains(event.target)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setOpen(false);
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
30
|
+
disabled: disabled,
|
|
31
|
+
ref: anchorRef,
|
|
32
|
+
onClick: handleToggle,
|
|
33
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
34
|
+
component: Icon,
|
|
35
|
+
sx: {
|
|
36
|
+
fontSize: 18
|
|
37
|
+
},
|
|
38
|
+
icon: "bxs:download"
|
|
39
|
+
})
|
|
40
|
+
}), /*#__PURE__*/_jsx(Popper, {
|
|
41
|
+
sx: {
|
|
42
|
+
zIndex: 10
|
|
43
|
+
},
|
|
44
|
+
open: open,
|
|
45
|
+
anchorEl: anchorRef.current,
|
|
46
|
+
placement: "bottom-end",
|
|
47
|
+
role: undefined,
|
|
48
|
+
transition: true,
|
|
49
|
+
disablePortal: true,
|
|
50
|
+
children: ({
|
|
51
|
+
TransitionProps
|
|
52
|
+
}) => /*#__PURE__*/_jsx(Grow, {
|
|
53
|
+
...TransitionProps,
|
|
54
|
+
style: {
|
|
55
|
+
transformOrigin: 'center top'
|
|
56
|
+
},
|
|
57
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
|
58
|
+
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
59
|
+
onClickAway: handleClose,
|
|
60
|
+
children: /*#__PURE__*/_jsxs(MenuList, {
|
|
61
|
+
id: "split-button-menu",
|
|
62
|
+
autoFocusItem: true,
|
|
63
|
+
sx: {
|
|
64
|
+
maxHeight: 300,
|
|
65
|
+
overflowY: 'auto',
|
|
66
|
+
zIndex: 10
|
|
67
|
+
},
|
|
68
|
+
children: [isPack && /*#__PURE__*/_jsx(Box, {
|
|
69
|
+
component: "a",
|
|
70
|
+
href: installUrl,
|
|
71
|
+
target: "_blank",
|
|
72
|
+
rel: "noreferrer",
|
|
73
|
+
sx: {
|
|
74
|
+
textDecoration: 'none'
|
|
75
|
+
},
|
|
76
|
+
children: /*#__PURE__*/_jsxs(MenuItem, {
|
|
77
|
+
sx: {
|
|
78
|
+
color: '#333'
|
|
79
|
+
},
|
|
80
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
81
|
+
component: Icon,
|
|
82
|
+
sx: {
|
|
83
|
+
mr: 1
|
|
84
|
+
},
|
|
85
|
+
icon: "ic:round-install-desktop"
|
|
86
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
87
|
+
variant: "inherit",
|
|
88
|
+
children: t('blocklet.publish.installToThisServer')
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
}), /*#__PURE__*/_jsxs(MenuItem, {
|
|
92
|
+
onClick: handleSetTip,
|
|
93
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
94
|
+
component: Icon,
|
|
95
|
+
sx: {
|
|
96
|
+
mr: 1
|
|
97
|
+
},
|
|
98
|
+
icon: "iconamoon:copy"
|
|
99
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
100
|
+
variant: "inherit",
|
|
101
|
+
children: t('blocklet.publish.copyInstallUrl')
|
|
102
|
+
})]
|
|
103
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
104
|
+
component: "a",
|
|
105
|
+
href: downloadUrl,
|
|
106
|
+
target: "_blank",
|
|
107
|
+
rel: "noreferrer",
|
|
108
|
+
sx: {
|
|
109
|
+
textDecoration: 'none'
|
|
110
|
+
},
|
|
111
|
+
children: /*#__PURE__*/_jsxs(MenuItem, {
|
|
112
|
+
sx: {
|
|
113
|
+
color: '#333'
|
|
114
|
+
},
|
|
115
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
116
|
+
component: Icon,
|
|
117
|
+
sx: {
|
|
118
|
+
mr: 1
|
|
119
|
+
},
|
|
120
|
+
icon: "ph:download"
|
|
121
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
122
|
+
variant: "inherit",
|
|
123
|
+
children: t('common.download')
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
})]
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
InstallButton.propTypes = {
|
|
135
|
+
disabled: PropTypes.bool.isRequired,
|
|
136
|
+
isPack: PropTypes.bool.isRequired,
|
|
137
|
+
downloadUrl: PropTypes.string.isRequired,
|
|
138
|
+
installUrl: PropTypes.string.isRequired,
|
|
139
|
+
handleSetTip: PropTypes.func.isRequired
|
|
140
|
+
};
|
|
@@ -9,7 +9,6 @@ import useSpaceGateways from '../hooks/use-space-gateways';
|
|
|
9
9
|
import { useNodeContext } from './node';
|
|
10
10
|
import useBackupProgress from '../hooks/use-backup-progress';
|
|
11
11
|
import useBackups from '../hooks/use-backups';
|
|
12
|
-
import { useAutoBackup } from '../hooks/use-auto-backup';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {import('../blocklet/storage/connected').SpaceGateway} SpaceGateway
|
|
@@ -82,19 +81,13 @@ function BlockletStorageProvider({
|
|
|
82
81
|
setLoading: setBackupsLoading
|
|
83
82
|
});
|
|
84
83
|
const [selectedSpaceGateway, setSelectedSpaceGateway] = useState(spaceGateways?.find(x => x.endpoint === backupEndpoint));
|
|
85
|
-
const
|
|
86
|
-
const autoBackup = useAutoBackup({
|
|
87
|
-
deps: [autoBackupRefresh]
|
|
88
|
-
});
|
|
84
|
+
const autoBackup = blocklet?.settings?.autoBackup;
|
|
89
85
|
const refreshSpaceGateways = () => {
|
|
90
86
|
setSpaceGatewaysRefresh(p => !p);
|
|
91
87
|
};
|
|
92
88
|
const refreshBackupEndpoint = () => {
|
|
93
89
|
setBackupEndpointRefresh(p => !p);
|
|
94
90
|
};
|
|
95
|
-
const refreshAutoBackup = () => {
|
|
96
|
-
setAutoBackupRefresh(x => !x);
|
|
97
|
-
};
|
|
98
91
|
|
|
99
92
|
/**
|
|
100
93
|
* @description
|
|
@@ -107,7 +100,6 @@ function BlockletStorageProvider({
|
|
|
107
100
|
autoBackup: value
|
|
108
101
|
}
|
|
109
102
|
});
|
|
110
|
-
refreshAutoBackup();
|
|
111
103
|
};
|
|
112
104
|
|
|
113
105
|
/**
|
package/lib/locales/ar.js
CHANGED
|
@@ -70,7 +70,7 @@ export default {
|
|
|
70
70
|
login: 'تسجيل الدخول',
|
|
71
71
|
tooltip: 'إذا كان لديك NFT من مجموعة {collections} ، يمكنك تبادل جواز سفرك بهذا الرابط.',
|
|
72
72
|
dialog: {
|
|
73
|
-
title: '
|
|
73
|
+
title: 'احصل على جواز سفر مع NFT',
|
|
74
74
|
scan: 'قم بتوصيل محفظة DID الخاصة بك لتقديم NFT الخاص بك للحصول على جواز سفر',
|
|
75
75
|
confirm: 'اختر NFT على محفظة DID الخاصة بك',
|
|
76
76
|
success: 'تم استبدال جواز السفر بنجاح'
|
|
@@ -743,7 +743,8 @@ export default {
|
|
|
743
743
|
possibleSameStoreTip: 'حاول حل بلوكليتات الاعتماد في نفس متجر البلوكليت قبل كل تحميل إذا كان ذلك ممكنًا',
|
|
744
744
|
needProjectId: 'يرجى إنشاء مشروع أولاً',
|
|
745
745
|
projectSettings: 'إعدادات المشروع',
|
|
746
|
-
noStoreSelected: 'يرجى تحديد أحد المتاجر الحالية أو إضافة متجر جديد للمتابعة'
|
|
746
|
+
noStoreSelected: 'يرجى تحديد أحد المتاجر الحالية أو إضافة متجر جديد للمتابعة',
|
|
747
|
+
installToThisServer: 'تثبيت على هذا الخادم'
|
|
747
748
|
},
|
|
748
749
|
titleValidationError: 'يجب أن يكون طول العنوان على الأقل 3 أحرف',
|
|
749
750
|
descriptionValidationError: 'يجب أن تكون طول الوصف بين 3 و 160 حرفًا',
|
|
@@ -1395,7 +1396,7 @@ export default {
|
|
|
1395
1396
|
ttlExchange: 'نظرًا لتبادل جوازات السفر',
|
|
1396
1397
|
ttlNeverTip: 'سيكون جواز السفر ساريًا حتى إلغاءه',
|
|
1397
1398
|
ttlMintTip: 'سيكون جواز السفر ساريًا بعد شراء رمز NFT حتى أنت تحدد ttl أو تلغيه',
|
|
1398
|
-
ttlExchangeTip: '
|
|
1399
|
+
ttlExchangeTip: 'سيكون جواز السفر ساري المفعول من الوقت الذي قام فيه المستخدم بالتبادل بنجاح حتى تحدد ttl أو تسحب',
|
|
1399
1400
|
ttlTip: '"365d" يعني 365 يومًا، يمكنك أيضًا استخدام "30 يومًا" أو "24 ساعة"',
|
|
1400
1401
|
validUntil: 'صالح حتى: {date}',
|
|
1401
1402
|
externalPassport: 'جواز السفر الخارجي',
|
package/lib/locales/de.js
CHANGED
|
@@ -70,7 +70,7 @@ export default {
|
|
|
70
70
|
login: 'Anmelden',
|
|
71
71
|
tooltip: 'Wenn du ein NFT aus der Sammlung {collections} besitzt, kannst du deinen Reisepass mit diesem Link austauschen.',
|
|
72
72
|
dialog: {
|
|
73
|
-
title: '
|
|
73
|
+
title: 'Holen Sie sich den Pass mit NFT',
|
|
74
74
|
scan: 'Verbinden Sie Ihre DID-Wallet, um Ihr NFT vorzustellen und einen Reisepass zu erhalten',
|
|
75
75
|
confirm: 'Wähle NFT in deiner DID Wallet aus',
|
|
76
76
|
success: 'Der Reisepass wurde erfolgreich ausgetauscht'
|
|
@@ -743,7 +743,8 @@ export default {
|
|
|
743
743
|
possibleSameStoreTip: 'Versuchen Sie, Abhängigkeits-Blocklets vor dem Hochladen, wenn möglich, im selben Blocklet-Store aufzulösen',
|
|
744
744
|
needProjectId: 'Bitte erstellen Sie zuerst ein Projekt',
|
|
745
745
|
projectSettings: 'Projekteinstellungen',
|
|
746
|
-
noStoreSelected: 'Bitte wählen Sie eine der vorhandenen Geschäfte aus oder fügen Sie ein neues Geschäft hinzu, um fortzufahren'
|
|
746
|
+
noStoreSelected: 'Bitte wählen Sie eine der vorhandenen Geschäfte aus oder fügen Sie ein neues Geschäft hinzu, um fortzufahren',
|
|
747
|
+
installToThisServer: 'Auf diesem Server installieren'
|
|
747
748
|
},
|
|
748
749
|
titleValidationError: 'Die Länge des Titels muss mindestens 3 Zeichen betragen',
|
|
749
750
|
descriptionValidationError: 'Die Beschreibungslänge muss zwischen 3 und 160 Zeichen liegen',
|
|
@@ -1395,7 +1396,7 @@ export default {
|
|
|
1395
1396
|
ttlExchange: 'Da Reisepass Austausch',
|
|
1396
1397
|
ttlNeverTip: 'Der Reisepass ist gültig bis auf Widerruf',
|
|
1397
1398
|
ttlMintTip: 'Der Reisepass bleibt gültig, solange der NFT gekauft wird, bis Sie ttl angegeben haben oder ihn widerrufen haben',
|
|
1398
|
-
ttlExchangeTip: 'Der Reisepass
|
|
1399
|
+
ttlExchangeTip: 'Der Reisepass ist gültig von dem Zeitpunkt an, an dem der Benutzer erfolgreich umgetauscht hat, bis Sie ttl oder widerrufen haben',
|
|
1399
1400
|
ttlTip: '365d bedeutet 365 Tage, du kannst auch "30 Tage" oder "24h" verwenden',
|
|
1400
1401
|
validUntil: 'Gültig bis: {date}',
|
|
1401
1402
|
externalPassport: 'Externer Reisepass',
|