@abtnode/ux 1.16.14-beta-c308dc3b → 1.16.14-beta-963cb583
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/es/actions.js +97 -0
- package/es/analytics/card.js +92 -0
- package/es/analytics/chart.js +96 -0
- package/es/analytics/cpu.js +36 -0
- package/es/analytics/disk.js +111 -0
- package/es/analytics/memory.js +72 -0
- package/es/analytics/runtime.js +173 -0
- package/es/analytics/traffic.js +259 -0
- package/es/blocklet/access/config-access.js +307 -0
- package/es/blocklet/access/index.js +216 -0
- package/es/blocklet/actions.js +474 -0
- package/es/blocklet/add-cert.js +177 -0
- package/es/blocklet/agreement-app.js +21 -0
- package/es/blocklet/agreement.js +127 -0
- package/es/blocklet/app-avatar.js +57 -0
- package/es/blocklet/audit-logs.js +259 -0
- package/es/blocklet/blocklet-source.js +48 -0
- package/es/blocklet/bundle-avatar.js +64 -0
- package/es/blocklet/component/add.js +1313 -0
- package/es/blocklet/component/configuration.js +122 -0
- package/es/blocklet/component/delete.js +134 -0
- package/es/blocklet/component/environment.js +370 -0
- package/es/blocklet/component/index.js +975 -0
- package/es/blocklet/component/line.js +20 -0
- package/es/blocklet/component/navigation/locale-tabs.js +225 -0
- package/es/blocklet/component/navigation/navigation-actions.js +112 -0
- package/es/blocklet/component/navigation/navigation-dialog.js +607 -0
- package/es/blocklet/component/navigation/navigation-preview.js +101 -0
- package/es/blocklet/component/navigation/simple-select.js +124 -0
- package/es/blocklet/component/select-store.js +155 -0
- package/es/blocklet/component/selected/index.js +94 -0
- package/es/blocklet/component/setting.js +109 -0
- package/es/blocklet/component/sortable-tree.js +126 -0
- package/es/blocklet/component/space-connector.js +199 -0
- package/es/blocklet/component/space-selector.js +178 -0
- package/es/blocklet/component/start.js +101 -0
- package/es/blocklet/component/store-blocklet-list.js +200 -0
- package/es/blocklet/component/switch-control.js +57 -0
- package/es/blocklet/config-navigation.js +331 -0
- package/es/blocklet/configuration.js +603 -0
- package/es/blocklet/disk-info.js +75 -0
- package/es/blocklet/icons.js +18 -0
- package/es/blocklet/install-from-url.js +337 -0
- package/es/blocklet/log.js +90 -0
- package/es/blocklet/migration.js +149 -0
- package/es/blocklet/mode.js +19 -0
- package/es/blocklet/notification/email.js +257 -0
- package/es/blocklet/notification/index.js +49 -0
- package/es/blocklet/oauth/auth0.js +145 -0
- package/es/blocklet/oauth/common-settings.js +133 -0
- package/es/blocklet/oauth/federated-detail-dialog.js +175 -0
- package/es/blocklet/oauth/federated-invite-dialog.js +83 -0
- package/es/blocklet/oauth/federated-join-dialog.js +111 -0
- package/es/blocklet/oauth/federated-site-list.js +338 -0
- package/es/blocklet/oauth/federated.js +81 -0
- package/es/blocklet/oauth/index.js +69 -0
- package/es/blocklet/overview.js +293 -0
- package/es/blocklet/page-group.js +19 -0
- package/es/blocklet/preferences/app-sk.js +142 -0
- package/es/blocklet/preferences/index.js +305 -0
- package/es/blocklet/purchase/common.js +95 -0
- package/es/blocklet/purchase/component-purchase.js +237 -0
- package/es/blocklet/purchase/index.js +4 -0
- package/es/blocklet/router/action/add-domain-alias.js +167 -0
- package/es/blocklet/router/action/add-rule.js +211 -0
- package/es/blocklet/router/action/config-routing-rule.js +232 -0
- package/es/blocklet/router/action/delete-domain-alias.js +99 -0
- package/es/blocklet/router/action/delete-rule.js +108 -0
- package/es/blocklet/router/action/update-rule.js +209 -0
- package/es/blocklet/router/domain-actions.js +64 -0
- package/es/blocklet/router/domain-status.js +88 -0
- package/es/blocklet/router/rule-actions.js +66 -0
- package/es/blocklet/router/rule-list.js +190 -0
- package/es/blocklet/router/util.js +131 -0
- package/es/blocklet/runtime-info.js +68 -0
- package/es/blocklet/status.js +91 -0
- package/es/blocklet/storage/action.js +134 -0
- package/es/blocklet/storage/backups.js +241 -0
- package/es/blocklet/storage/connect-to.js +372 -0
- package/es/blocklet/storage/connected.js +198 -0
- package/es/blocklet/storage/delete.js +113 -0
- package/es/blocklet/storage/disconnect.js +243 -0
- package/es/blocklet/storage/index.js +19 -0
- package/es/blocklet/storage/item.js +558 -0
- package/es/blocklet/storage/preview-nft.js +286 -0
- package/es/blocklet/transfer-owner.js +198 -0
- package/es/blocklet/types.js +18 -0
- package/es/blocklet/util.js +145 -0
- package/es/blocklet/version.js +141 -0
- package/es/card-selector.js +134 -0
- package/es/certificate.js +105 -0
- package/es/chain.js +13 -0
- package/es/click-to-copy.js +22 -0
- package/es/confirm.js +149 -0
- package/es/contexts/audit-log.js +152 -0
- package/es/contexts/blocklet.js +10 -0
- package/es/contexts/deleting-blocklets.js +70 -0
- package/es/contexts/node.js +17 -0
- package/es/contexts/session.js +8 -0
- package/es/contexts/team.js +10 -0
- package/es/delete-confirm.js +121 -0
- package/es/did-address.js +46 -0
- package/es/dot.js +14 -0
- package/es/exchange-passport.js +102 -0
- package/es/form/form-select-input.js +184 -0
- package/es/form/form-text-input.js +178 -0
- package/es/form/form-wrapper.js +88 -0
- package/es/form/input-triggers.js +98 -0
- package/es/form/required.js +8 -0
- package/es/hooks/blocklet.js +229 -0
- package/es/hooks/confirm.js +90 -0
- package/es/hooks/mobile-width.js +11 -0
- package/es/hooks/url-evaluation.js +155 -0
- package/es/hooks/use-app-logo.js +16 -0
- package/es/hooks/use-backup-progress.js +31 -0
- package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +50 -0
- package/es/hooks/use-bundle-logo.js +27 -0
- package/es/hooks/use-navigation.js +347 -0
- package/es/hooks/use-passport-id.js +14 -0
- package/es/hooks/use-subscription.js +22 -0
- package/es/icons/empty-space-nft.svg +59 -0
- package/es/icons/empty-spaces-nft.svg +58 -0
- package/es/icons/long-arrow.svg +5 -0
- package/es/icons/space-connected.svg +3 -0
- package/es/icons/space-disconnect.svg +3 -0
- package/es/index.js +3 -0
- package/es/invitation/invitation-app.js +58 -0
- package/es/invitation/invitation-login.js +68 -0
- package/es/invitation/invitation-passport.js +146 -0
- package/es/invitation/invitation-receive.js +138 -0
- package/es/invitation/invitation-success.js +93 -0
- package/es/invitation/invitation-user.js +90 -0
- package/es/invitation/invitation.js +90 -0
- package/es/issue-passport.js +142 -0
- package/es/launch-blocklet/content-layout.js +58 -0
- package/es/launch-blocklet/page-header.js +43 -0
- package/es/layout/addon.js +114 -0
- package/es/layout/feedback.js +55 -0
- package/es/locales/en.js +1541 -0
- package/es/locales/index.js +9 -0
- package/es/locales/zh.js +1544 -0
- package/es/logs/clock.js +11 -0
- package/es/logs/download.js +132 -0
- package/es/logs/log-terminal.js +253 -0
- package/es/lost-passport.js +452 -0
- package/es/nav-logo.js +219 -0
- package/es/passport-tag.js +43 -0
- package/es/permission.js +57 -0
- package/es/relative-time.js +53 -0
- package/es/result-message.js +11 -0
- package/es/schema-form/color-input.js +98 -0
- package/es/schema-form/common-prop-types.js +13 -0
- package/es/schema-form/index.js +215 -0
- package/es/schema-form/passport-input.js +55 -0
- package/es/schema-form/text-input.js +57 -0
- package/es/store/add.js +179 -0
- package/es/store/delete.js +96 -0
- package/es/store/item.js +76 -0
- package/es/subscription.js +144 -0
- package/es/table-icons.js +34 -0
- package/es/table.js +52 -0
- package/es/tag.js +21 -0
- package/es/team/members/actions.js +89 -0
- package/es/team/members/index.js +636 -0
- package/es/team/members/invitations.js +188 -0
- package/es/team/members/invite-member.js +208 -0
- package/es/team/members/issue-passport.js +152 -0
- package/es/team/members/member.js +408 -0
- package/es/team/members/passport-issuances.js +155 -0
- package/es/team/members/passports.js +364 -0
- package/es/team/members/toggle-user-approval.js +122 -0
- package/es/team/members/transfer-node.js +256 -0
- package/es/team/members/util.js +14 -0
- package/es/team/passports/color.js +127 -0
- package/es/team/passports/detail.js +312 -0
- package/es/team/passports/index.js +282 -0
- package/es/team/passports/mutate-role.js +198 -0
- package/es/team/passports/trusted-factories.js +221 -0
- package/es/team/passports/trusted-factory.js +343 -0
- package/es/team/passports/trusted-issuer.js +296 -0
- package/es/team/passports/trusted-issuers.js +226 -0
- package/es/team/search-input.js +46 -0
- package/es/team/styles/dialog.js +72 -0
- package/es/team/styles/list-header.js +31 -0
- package/es/util/api.js +6 -0
- package/es/util/constants.js +2 -0
- package/es/util/index.js +598 -0
- package/es/util/mode.js +4 -0
- package/es/util/space-gateway.js +51 -0
- package/es/util/spaces.js +160 -0
- package/es/who-can-access/config.js +38 -0
- package/es/wrap-locale.js +15 -0
- package/lib/blocklet/component/add.js +5 -0
- package/lib/blocklet/component/selected/index.js +47 -0
- package/lib/blocklet/component/space-connector.js +1 -1
- package/lib/blocklet/component/space-selector.js +1 -1
- package/lib/blocklet/storage/backups.js +1 -1
- package/lib/blocklet/storage/connect-to.js +6 -7
- package/lib/blocklet/storage/connected.js +1 -1
- package/lib/blocklet/storage/disconnect.js +1 -1
- package/lib/blocklet/storage/index.js +1 -1
- package/lib/blocklet/storage/item.js +1 -1
- package/lib/card-selector.js +14 -14
- package/lib/invitation/invitation-passport.js +7 -6
- package/lib/invitation/invitation-receive.js +1 -1
- package/lib/locales/en.js +12 -5
- package/lib/locales/zh.js +10 -3
- package/lib/lost-passport.js +2 -2
- package/lib/schema-form/passport-input.js +12 -11
- package/lib/team/passports/color.js +14 -14
- package/lib/team/passports/trusted-factory.js +1 -1
- package/lib/util/spaces.js +13 -1
- package/package.json +88 -21
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
+
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
+
import DidButton from '@arcblock/did-connect/lib/Button';
|
|
7
|
+
import { getWebWalletUrl } from '@arcblock/did-connect/lib/utils';
|
|
8
|
+
import { formatDateTime } from '../util';
|
|
9
|
+
import usePassportId from '../hooks/use-passport-id';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
function InvitationReceive({
|
|
14
|
+
invitation,
|
|
15
|
+
checkFn,
|
|
16
|
+
onLogin,
|
|
17
|
+
onReceive
|
|
18
|
+
}) {
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const {
|
|
21
|
+
t,
|
|
22
|
+
locale
|
|
23
|
+
} = useLocaleContext();
|
|
24
|
+
const {
|
|
25
|
+
getPassportId
|
|
26
|
+
} = usePassportId();
|
|
27
|
+
let componentId;
|
|
28
|
+
if (typeof window !== 'undefined') {
|
|
29
|
+
componentId = window?.blocklet?.componentId;
|
|
30
|
+
}
|
|
31
|
+
const extraParams = {
|
|
32
|
+
passportId: getPassportId(),
|
|
33
|
+
inviteId: invitation.inviteId,
|
|
34
|
+
// 生成 passport 信息需要 baseUrl 字段
|
|
35
|
+
baseUrl: window.location.origin,
|
|
36
|
+
componentId
|
|
37
|
+
};
|
|
38
|
+
const onClose = useCallback(() => {
|
|
39
|
+
setOpen(false);
|
|
40
|
+
}, []);
|
|
41
|
+
const onSuccess = useCallback((...args) => {
|
|
42
|
+
setOpen(false);
|
|
43
|
+
onLogin(...args);
|
|
44
|
+
}, [onLogin]);
|
|
45
|
+
const onClickReceive = useCallback(() => {
|
|
46
|
+
if (typeof onReceive === 'function') {
|
|
47
|
+
onReceive();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
setOpen(true);
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
+
children: [/*#__PURE__*/_jsxs(Root, {
|
|
55
|
+
children: [/*#__PURE__*/_jsx(DidButton, {
|
|
56
|
+
size: "large",
|
|
57
|
+
variant: "contained",
|
|
58
|
+
className: "invite-receive__button",
|
|
59
|
+
"data-cy": "invite-receive-passport",
|
|
60
|
+
color: "primary",
|
|
61
|
+
onClick: onClickReceive,
|
|
62
|
+
children: t('invite.receive')
|
|
63
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
64
|
+
className: "invite-receive__until",
|
|
65
|
+
children: [t('invite.validUntil'), formatDateTime(invitation.expireDate, locale)]
|
|
66
|
+
})]
|
|
67
|
+
}), /*#__PURE__*/_jsx(DidConnect, {
|
|
68
|
+
popup: true,
|
|
69
|
+
open: open,
|
|
70
|
+
className: "connect",
|
|
71
|
+
action: "invite",
|
|
72
|
+
checkFn: checkFn,
|
|
73
|
+
forceConnected: false,
|
|
74
|
+
autoConnect: false,
|
|
75
|
+
checkTimeout: 10 * 60 * 1000,
|
|
76
|
+
onSuccess: onSuccess,
|
|
77
|
+
onClose: onClose,
|
|
78
|
+
locale: locale,
|
|
79
|
+
webWalletUrl: getWebWalletUrl(),
|
|
80
|
+
messages: {
|
|
81
|
+
title: t('receive.dialog.title'),
|
|
82
|
+
scan: t('receive.dialog.scan'),
|
|
83
|
+
confirm: t('receive.dialog.confirm'),
|
|
84
|
+
success: t('receive.dialog.success')
|
|
85
|
+
},
|
|
86
|
+
extraParams: extraParams
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
InvitationReceive.propTypes = {
|
|
91
|
+
invitation: PropTypes.object.isRequired,
|
|
92
|
+
checkFn: PropTypes.func.isRequired,
|
|
93
|
+
onLogin: PropTypes.func,
|
|
94
|
+
onReceive: PropTypes.func
|
|
95
|
+
};
|
|
96
|
+
InvitationReceive.defaultProps = {
|
|
97
|
+
onLogin: () => {},
|
|
98
|
+
onReceive: null
|
|
99
|
+
};
|
|
100
|
+
const Root = styled.div`
|
|
101
|
+
text-align: center;
|
|
102
|
+
.invite-receive__logo-wrapper {
|
|
103
|
+
display: inline-flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
color: #9397a1;
|
|
106
|
+
font-size: 14px;
|
|
107
|
+
}
|
|
108
|
+
.invite-receive__logo {
|
|
109
|
+
height: 16px;
|
|
110
|
+
margin-left: 8px;
|
|
111
|
+
}
|
|
112
|
+
.invite-receive__button {
|
|
113
|
+
width: 100%;
|
|
114
|
+
margin: 16px 0;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
}
|
|
117
|
+
.invite-receive__until {
|
|
118
|
+
text-align: center;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
}
|
|
121
|
+
.invite-receive__description {
|
|
122
|
+
color: #999;
|
|
123
|
+
text-align: left;
|
|
124
|
+
list-style: decimal;
|
|
125
|
+
padding: 0;
|
|
126
|
+
padding-left: 1.2em;
|
|
127
|
+
margin: 40px 0;
|
|
128
|
+
}
|
|
129
|
+
.invite-receive__description-item {
|
|
130
|
+
list-style: decimal;
|
|
131
|
+
}
|
|
132
|
+
.invite-receive__link {
|
|
133
|
+
color: ${({
|
|
134
|
+
theme
|
|
135
|
+
}) => theme.palette.primary.main};
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
export default InvitationReceive;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
8
|
+
import { getExplorerLink, patchJsxToLocale } from '../util';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function InvitationSuccess({
|
|
12
|
+
invitation,
|
|
13
|
+
type
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useLocaleContext();
|
|
18
|
+
const message = useMemo(() => {
|
|
19
|
+
return t('invite.success', {
|
|
20
|
+
dapp: '{{dapp}}'
|
|
21
|
+
});
|
|
22
|
+
}, [t]);
|
|
23
|
+
const accountLink = getExplorerLink(invitation.info.chainHost, invitation.inviter.did, 'account');
|
|
24
|
+
const user = type === 'receiver' ? invitation.receiver : invitation.inviter;
|
|
25
|
+
const messageList = patchJsxToLocale(message, {
|
|
26
|
+
name() {
|
|
27
|
+
return accountLink ? /*#__PURE__*/_jsx("a", {
|
|
28
|
+
target: "_blank",
|
|
29
|
+
href: accountLink,
|
|
30
|
+
className: "invite-user__link",
|
|
31
|
+
rel: "noreferrer",
|
|
32
|
+
children: user.fullName
|
|
33
|
+
}, "name") : user.fullName;
|
|
34
|
+
},
|
|
35
|
+
dapp() {
|
|
36
|
+
return /*#__PURE__*/_jsx("a", {
|
|
37
|
+
target: "_blank",
|
|
38
|
+
href: invitation.info.url,
|
|
39
|
+
className: "invite-user__link",
|
|
40
|
+
rel: "noreferrer",
|
|
41
|
+
children: invitation.info.name
|
|
42
|
+
}, "dapp");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
47
|
+
pt: 1,
|
|
48
|
+
color: "success.main",
|
|
49
|
+
children: /*#__PURE__*/_jsx(CheckCircleIcon, {
|
|
50
|
+
style: {
|
|
51
|
+
fontSize: 80
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
55
|
+
className: "invite-user__message",
|
|
56
|
+
children: messageList
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
InvitationSuccess.propTypes = {
|
|
61
|
+
invitation: PropTypes.object.isRequired,
|
|
62
|
+
type: PropTypes.oneOf('inviter', 'receiver')
|
|
63
|
+
};
|
|
64
|
+
InvitationSuccess.defaultProps = {
|
|
65
|
+
type: 'inviter'
|
|
66
|
+
};
|
|
67
|
+
const Root = styled.div`
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
.invite-user__name {
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
font-size: 16px;
|
|
75
|
+
margin: 8px 0 2px 0;
|
|
76
|
+
}
|
|
77
|
+
.invite-user__address {
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
}
|
|
80
|
+
.invite-user__message {
|
|
81
|
+
margin-top: 20px;
|
|
82
|
+
font-weight: 700;
|
|
83
|
+
/* width: 90%; */
|
|
84
|
+
text-align: center;
|
|
85
|
+
font-size: 18px;
|
|
86
|
+
}
|
|
87
|
+
.invite-user__link {
|
|
88
|
+
color: ${({
|
|
89
|
+
theme
|
|
90
|
+
}) => theme.palette.primary.main};
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
export default InvitationSuccess;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import DidAvatar from '@arcblock/did-connect/lib/Avatar';
|
|
6
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import { getExplorerLink, patchJsxToLocale } from '../util';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
function InvitationUser({
|
|
11
|
+
invitation
|
|
12
|
+
}) {
|
|
13
|
+
const {
|
|
14
|
+
t
|
|
15
|
+
} = useLocaleContext();
|
|
16
|
+
const roleName = useMemo(() => {
|
|
17
|
+
const role = invitation.role.title || invitation.role.name;
|
|
18
|
+
return role.toUpperCase();
|
|
19
|
+
}, [invitation.role.title, invitation.role.name]);
|
|
20
|
+
const message = useMemo(() => {
|
|
21
|
+
return t('invite.message', {
|
|
22
|
+
name: '{{name}}',
|
|
23
|
+
role: roleName,
|
|
24
|
+
dapp: '{{dapp}}'
|
|
25
|
+
});
|
|
26
|
+
}, [t, roleName]);
|
|
27
|
+
const accountLink = getExplorerLink(invitation.info.chainHost, invitation.inviter.did, 'account');
|
|
28
|
+
const messageList = patchJsxToLocale(message, {
|
|
29
|
+
name() {
|
|
30
|
+
return accountLink ? /*#__PURE__*/_jsx("a", {
|
|
31
|
+
target: "_blank",
|
|
32
|
+
href: accountLink,
|
|
33
|
+
className: "invite-user__link",
|
|
34
|
+
rel: "noreferrer",
|
|
35
|
+
children: invitation.inviter.fullName
|
|
36
|
+
}, "name") : invitation.inviter.fullName;
|
|
37
|
+
},
|
|
38
|
+
dapp() {
|
|
39
|
+
return /*#__PURE__*/_jsx("a", {
|
|
40
|
+
target: "_blank",
|
|
41
|
+
href: invitation.info.url,
|
|
42
|
+
className: "invite-user__link",
|
|
43
|
+
rel: "noreferrer",
|
|
44
|
+
children: invitation.info.name
|
|
45
|
+
}, "dapp");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
49
|
+
children: [/*#__PURE__*/_jsx(DidAvatar, {
|
|
50
|
+
did: invitation.inviter.did,
|
|
51
|
+
src: encodeURI(invitation.inviter.avatar),
|
|
52
|
+
size: 80,
|
|
53
|
+
shape: "circle",
|
|
54
|
+
variant: "circle"
|
|
55
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
56
|
+
className: "invite-user__message",
|
|
57
|
+
children: messageList
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
InvitationUser.propTypes = {
|
|
62
|
+
invitation: PropTypes.object.isRequired
|
|
63
|
+
};
|
|
64
|
+
const Root = styled.div`
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
.invite-user__name {
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
margin: 8px 0 2px 0;
|
|
73
|
+
}
|
|
74
|
+
.invite-user__address {
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
}
|
|
77
|
+
.invite-user__message {
|
|
78
|
+
margin-top: 20px;
|
|
79
|
+
font-weight: 700;
|
|
80
|
+
/* width: 90%; */
|
|
81
|
+
text-align: center;
|
|
82
|
+
font-size: 18px;
|
|
83
|
+
}
|
|
84
|
+
.invite-user__link {
|
|
85
|
+
color: ${({
|
|
86
|
+
theme
|
|
87
|
+
}) => theme.palette.primary.main};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
export default InvitationUser;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { useRequest } from 'ahooks';
|
|
4
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
+
import Result from '@arcblock/ux/lib/Result';
|
|
6
|
+
import InvitationPassport from './invitation-passport';
|
|
7
|
+
import InvitationReceive from './invitation-receive';
|
|
8
|
+
import InvitationLogin from './invitation-login';
|
|
9
|
+
import InvitationUser from './invitation-user';
|
|
10
|
+
import InvitationSuccess from './invitation-success';
|
|
11
|
+
import InvitationApp from './invitation-app';
|
|
12
|
+
import wrapLocale from '../wrap-locale';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
function Invitation({
|
|
16
|
+
getDataFn,
|
|
17
|
+
passportColor,
|
|
18
|
+
createPassportSvg,
|
|
19
|
+
onLoginSuccess,
|
|
20
|
+
checkFn,
|
|
21
|
+
onReceive
|
|
22
|
+
}) {
|
|
23
|
+
const state = useRequest(getDataFn);
|
|
24
|
+
if (state.loading) {
|
|
25
|
+
return /*#__PURE__*/_jsx(Spinner, {});
|
|
26
|
+
}
|
|
27
|
+
if (state.error) {
|
|
28
|
+
return /*#__PURE__*/_jsx(Result, {
|
|
29
|
+
status: "404",
|
|
30
|
+
title: state.error?.response?.data,
|
|
31
|
+
description: ""
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const isSuccess = state.data.status === 'success';
|
|
35
|
+
const Section1 = isSuccess ? InvitationSuccess : InvitationUser;
|
|
36
|
+
const Section2 = isSuccess ? InvitationLogin : InvitationReceive;
|
|
37
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
38
|
+
className: "page-invite__wrapper",
|
|
39
|
+
children: [/*#__PURE__*/_jsx(InvitationApp, {
|
|
40
|
+
invitation: state.data
|
|
41
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
42
|
+
className: "page-invite__card",
|
|
43
|
+
children: [/*#__PURE__*/_jsx(Section1, {
|
|
44
|
+
invitation: state.data
|
|
45
|
+
}), /*#__PURE__*/_jsx(InvitationPassport, {
|
|
46
|
+
invitation: state.data,
|
|
47
|
+
createPassportSvg: createPassportSvg,
|
|
48
|
+
passportColor: passportColor
|
|
49
|
+
}), /*#__PURE__*/_jsx(Section2, {
|
|
50
|
+
invitation: state.data,
|
|
51
|
+
onLogin: onLoginSuccess,
|
|
52
|
+
checkFn: checkFn,
|
|
53
|
+
onReceive: onReceive
|
|
54
|
+
})]
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
Invitation.propTypes = {
|
|
59
|
+
getDataFn: PropTypes.func.isRequired,
|
|
60
|
+
checkFn: PropTypes.func.isRequired,
|
|
61
|
+
createPassportSvg: PropTypes.func.isRequired,
|
|
62
|
+
onLoginSuccess: PropTypes.func,
|
|
63
|
+
onReceive: PropTypes.func,
|
|
64
|
+
passportColor: PropTypes.string
|
|
65
|
+
};
|
|
66
|
+
Invitation.defaultProps = {
|
|
67
|
+
onLoginSuccess: () => {},
|
|
68
|
+
passportColor: 'auto',
|
|
69
|
+
onReceive: null
|
|
70
|
+
};
|
|
71
|
+
const Root = styled.div`
|
|
72
|
+
max-width: 460px;
|
|
73
|
+
max-height: 650px;
|
|
74
|
+
min-height: 450px;
|
|
75
|
+
width: 90%;
|
|
76
|
+
height: 80%;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
.page-invite__card {
|
|
80
|
+
background-color: #fff;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
flex: 1;
|
|
83
|
+
padding: 20px 30px;
|
|
84
|
+
margin-top: 10px;
|
|
85
|
+
}
|
|
86
|
+
.page-invite__app {
|
|
87
|
+
margin-top: 20px;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
export default wrapLocale(Invitation);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-one-expression-per-line, no-undef */
|
|
2
|
+
import { useState, useContext } from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
7
|
+
import Box from '@mui/material/Box';
|
|
8
|
+
import Center from '@arcblock/ux/lib/Center';
|
|
9
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
10
|
+
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
11
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
12
|
+
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
13
|
+
import wrapLocale from './wrap-locale';
|
|
14
|
+
import usePassportId from './hooks/use-passport-id';
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line react/prop-types
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
function IssuePassport({
|
|
20
|
+
SessionContext,
|
|
21
|
+
webWalletUrl
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
api,
|
|
25
|
+
session
|
|
26
|
+
} = useContext(SessionContext);
|
|
27
|
+
const {
|
|
28
|
+
t,
|
|
29
|
+
locale
|
|
30
|
+
} = useContext(LocaleContext);
|
|
31
|
+
const [success, setSuccess] = useState(false);
|
|
32
|
+
const navigate = useNavigate();
|
|
33
|
+
const {
|
|
34
|
+
setPassportId
|
|
35
|
+
} = usePassportId();
|
|
36
|
+
const onReceivePassport = result => {
|
|
37
|
+
if (result?.passportId) {
|
|
38
|
+
setPassportId(result.passportId);
|
|
39
|
+
}
|
|
40
|
+
setSuccess(true);
|
|
41
|
+
};
|
|
42
|
+
const extraParams = {};
|
|
43
|
+
const {
|
|
44
|
+
searchParams
|
|
45
|
+
} = new URL(window.location.href);
|
|
46
|
+
const id = searchParams.get('id');
|
|
47
|
+
if (id) {
|
|
48
|
+
extraParams.id = id;
|
|
49
|
+
}
|
|
50
|
+
const onUsePassport = () => {
|
|
51
|
+
try {
|
|
52
|
+
session.logout();
|
|
53
|
+
} catch (err) {
|
|
54
|
+
// Do nothing
|
|
55
|
+
}
|
|
56
|
+
if ((window.env?.apiPrefix || '').startsWith(WELLKNOWN_SERVICE_PATH_PREFIX)) {
|
|
57
|
+
navigate(`${WELLKNOWN_SERVICE_PATH_PREFIX}/login`, {
|
|
58
|
+
replace: true
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
navigate('/', {
|
|
63
|
+
replace: true
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/_jsx(Div, {
|
|
67
|
+
children: success ? /*#__PURE__*/_jsx("div", {
|
|
68
|
+
className: "login",
|
|
69
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
70
|
+
className: "connect",
|
|
71
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
72
|
+
textAlign: "center",
|
|
73
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
74
|
+
mb: 3,
|
|
75
|
+
color: "success.main",
|
|
76
|
+
children: /*#__PURE__*/_jsx(CheckCircleIcon, {
|
|
77
|
+
style: {
|
|
78
|
+
fontSize: 60
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
82
|
+
component: "p",
|
|
83
|
+
variant: "body1",
|
|
84
|
+
className: "subheader",
|
|
85
|
+
children: t('issuePassport.dialog.success')
|
|
86
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
87
|
+
mt: 3,
|
|
88
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
89
|
+
variant: "contained",
|
|
90
|
+
color: "primary",
|
|
91
|
+
onClick: onUsePassport,
|
|
92
|
+
children: t('issuePassport.dialog.loginWithPassport')
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
}) : /*#__PURE__*/_jsx(DidConnect, {
|
|
98
|
+
className: "connect",
|
|
99
|
+
action: "issue-passport",
|
|
100
|
+
forceConnected: false,
|
|
101
|
+
autoConnect: false,
|
|
102
|
+
checkFn: api.get,
|
|
103
|
+
checkTimeout: 10 * 60 * 1000,
|
|
104
|
+
webWalletUrl: webWalletUrl,
|
|
105
|
+
onSuccess: onReceivePassport,
|
|
106
|
+
locale: locale,
|
|
107
|
+
messages: {
|
|
108
|
+
title: t('issuePassport.title'),
|
|
109
|
+
scan: t('issuePassport.description', {
|
|
110
|
+
name: window.env.appName
|
|
111
|
+
}),
|
|
112
|
+
confirm: t('issuePassport.dialog.confirm'),
|
|
113
|
+
success: t('issuePassport.dialog.success')
|
|
114
|
+
},
|
|
115
|
+
extraParams: extraParams
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const Div = styled(Center)`
|
|
120
|
+
.header {
|
|
121
|
+
text-align: center;
|
|
122
|
+
margin-bottom: 8px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.subheader {
|
|
126
|
+
text-align: center;
|
|
127
|
+
margin-bottom: 24px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.login {
|
|
131
|
+
padding: 24px;
|
|
132
|
+
height: auto;
|
|
133
|
+
min-height: 480px;
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.connect {
|
|
139
|
+
background: #fafafa;
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
export default wrapLocale(IssuePassport);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function ContentLayout({
|
|
5
|
+
children,
|
|
6
|
+
...props
|
|
7
|
+
}) {
|
|
8
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
9
|
+
...props,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
ContentLayout.propTypes = {
|
|
14
|
+
children: PropTypes.any.isRequired
|
|
15
|
+
};
|
|
16
|
+
const Container = styled.div`
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
|
|
23
|
+
.header {
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.body {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
margin-top: 30px;
|
|
32
|
+
width: 100%;
|
|
33
|
+
min-height: 200px;
|
|
34
|
+
flex: 1;
|
|
35
|
+
|
|
36
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
37
|
+
padding: 24px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
41
|
+
padding: 0 16px 16px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
|
|
49
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
50
|
+
padding-bottom: 34px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
54
|
+
margin-top: auto;
|
|
55
|
+
padding-bottom: 10px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
function PageHeader({
|
|
6
|
+
title,
|
|
7
|
+
subTitle
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/_jsxs(Content, {
|
|
10
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
11
|
+
className: "title",
|
|
12
|
+
children: title
|
|
13
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
14
|
+
className: "sub-title",
|
|
15
|
+
children: subTitle
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const Content = styled.div`
|
|
20
|
+
text-align: center;
|
|
21
|
+
|
|
22
|
+
.title {
|
|
23
|
+
font-size: 24px;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
color: ${props => props.theme.palette.common.black};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sub-title {
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
max-width: 90%;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
color: ${props => props.theme.palette.grey[600]};
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
export default PageHeader;
|
|
36
|
+
PageHeader.propTypes = {
|
|
37
|
+
title: PropTypes.string,
|
|
38
|
+
subTitle: PropTypes.string
|
|
39
|
+
};
|
|
40
|
+
PageHeader.defaultProps = {
|
|
41
|
+
title: '',
|
|
42
|
+
subTitle: ''
|
|
43
|
+
};
|