@arcblock/ux 2.13.28 → 2.13.30
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/DIDConnect/did-connect-container.d.ts +2 -1
- package/lib/DIDConnect/did-connect-container.js +4 -2
- package/lib/DIDConnect/index.d.ts +1 -0
- package/lib/DIDConnect/index.js +2 -1
- package/lib/DIDConnect/request-storage-access-api-dialog.d.ts +12 -0
- package/lib/DIDConnect/request-storage-access-api-dialog.js +325 -0
- package/lib/RelativeTime/index.d.ts +2 -1
- package/lib/RelativeTime/index.js +30 -21
- package/lib/SessionUser/components/un-login.js +29 -37
- package/lib/SharedBridge/index.d.ts +5 -6
- package/lib/SharedBridge/index.js +34 -48
- package/package.json +6 -6
- package/src/DIDConnect/did-connect-container.tsx +4 -1
- package/src/DIDConnect/index.ts +1 -0
- package/src/DIDConnect/request-storage-access-api-dialog.tsx +280 -0
- package/src/RelativeTime/index.tsx +32 -16
- package/src/SessionUser/components/un-login.tsx +21 -29
- package/src/SharedBridge/index.tsx +91 -97
- package/lib/LoginButton/index.d.ts +0 -12
- package/lib/LoginButton/index.js +0 -74
- package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +0 -6
- package/lib/SharedBridge/need-storage-access-api-dialog.js +0 -191
- package/src/LoginButton/index.tsx +0 -73
- package/src/SharedBridge/need-storage-access-api-dialog.tsx +0 -149
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SxProps } from '@mui/material';
|
2
|
-
export default function DIDConnectContainer({ open, popup, hideCloseButton, children, appPid, slotProps, onClose, }: {
|
2
|
+
export default function DIDConnectContainer({ open, popup, hideCloseButton, children, appPid, slotProps, onClose, keepMounted, }: {
|
3
3
|
popup?: boolean;
|
4
4
|
open?: boolean;
|
5
5
|
hideCloseButton?: boolean;
|
@@ -20,4 +20,5 @@ export default function DIDConnectContainer({ open, popup, hideCloseButton, chil
|
|
20
20
|
sx?: SxProps;
|
21
21
|
};
|
22
22
|
};
|
23
|
+
keepMounted?: boolean;
|
23
24
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -30,7 +30,8 @@ export default function DIDConnectContainer({
|
|
30
30
|
children,
|
31
31
|
appPid,
|
32
32
|
slotProps,
|
33
|
-
onClose = noop
|
33
|
+
onClose = noop,
|
34
|
+
keepMounted = false
|
34
35
|
}) {
|
35
36
|
const color = useCreation(() => {
|
36
37
|
const did = appPid || window.blocklet.appPid;
|
@@ -63,7 +64,7 @@ export default function DIDConnectContainer({
|
|
63
64
|
if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
|
64
65
|
onClose();
|
65
66
|
};
|
66
|
-
const showModal = debouncedOpen || open;
|
67
|
+
const showModal = debouncedOpen || open || keepMounted;
|
67
68
|
const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
|
68
69
|
const hslColor = colorConvert.hex.hsl(color);
|
69
70
|
const [h, s, l] = hslColor;
|
@@ -237,6 +238,7 @@ export default function DIDConnectContainer({
|
|
237
238
|
slots: {
|
238
239
|
backdrop: BackdropWrap
|
239
240
|
},
|
241
|
+
keepMounted: keepMounted,
|
240
242
|
className: "did-connect__container-dialog",
|
241
243
|
onClose: handleOnClose,
|
242
244
|
PaperProps: {
|
@@ -6,3 +6,4 @@ export { default as withContainer } from './with-container';
|
|
6
6
|
export { default as withUxTheme } from './with-ux-theme';
|
7
7
|
export { default as DIDConnectLogo } from './did-connect-logo';
|
8
8
|
export { default as DIDConnectContainer } from './did-connect-container';
|
9
|
+
export { default as RequestStorageAccessApiDialog } from './request-storage-access-api-dialog';
|
package/lib/DIDConnect/index.js
CHANGED
@@ -5,4 +5,5 @@ export { default as PoweredBy } from './powered-by';
|
|
5
5
|
export { default as withContainer } from './with-container';
|
6
6
|
export { default as withUxTheme } from './with-ux-theme';
|
7
7
|
export { default as DIDConnectLogo } from './did-connect-logo';
|
8
|
-
export { default as DIDConnectContainer } from './did-connect-container';
|
8
|
+
export { default as DIDConnectContainer } from './did-connect-container';
|
9
|
+
export { default as RequestStorageAccessApiDialog } from './request-storage-access-api-dialog';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Locale } from '../type';
|
2
|
+
type StorageAccessState = 'prompt' | 'granted' | 'denied';
|
3
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
4
|
+
locale?: Locale;
|
5
|
+
src: string;
|
6
|
+
storageAccessState: StorageAccessState;
|
7
|
+
onHandle: (data: {
|
8
|
+
value: boolean;
|
9
|
+
error?: Error;
|
10
|
+
}) => void;
|
11
|
+
} & import("react").RefAttributes<unknown>>>;
|
12
|
+
export default _default;
|
@@ -0,0 +1,325 @@
|
|
1
|
+
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Box, Button, Typography, Chip, List, ListItem } from '@mui/material';
|
3
|
+
import { Icon } from '@iconify/react';
|
4
|
+
import externalLinkIcon from '@iconify-icons/tabler/external-link';
|
5
|
+
import lockOutlineIcon from '@iconify-icons/material-symbols/lock-outline';
|
6
|
+
import checkCircleIcon from '@iconify-icons/material-symbols/check-circle';
|
7
|
+
import rocketLaunchRoundedIcon from '@iconify-icons/material-symbols/rocket-launch-rounded';
|
8
|
+
import { useMemoizedFn, useReactive } from 'ahooks';
|
9
|
+
import { forwardRef, memo, useImperativeHandle, useRef } from 'react';
|
10
|
+
import noop from 'lodash/noop';
|
11
|
+
import { translate } from '../Locale/util';
|
12
|
+
import DIDConnectContainer from './did-connect-container';
|
13
|
+
import CloseButton from '../CloseButton';
|
14
|
+
import SharedBridge from '../SharedBridge';
|
15
|
+
import { setVisitorId } from '../Util';
|
16
|
+
const translations = {
|
17
|
+
en: {
|
18
|
+
allow: 'Allow',
|
19
|
+
dataUsage: 'Your data is only used for identity authentication, and will not be collected or used for any other purpose.',
|
20
|
+
title: 'Authorization Request',
|
21
|
+
clickAllow: ({
|
22
|
+
allowButton
|
23
|
+
}) => {
|
24
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
25
|
+
children: ["You only need to click the ", allowButton, " button below, and you will not see this request again."]
|
26
|
+
});
|
27
|
+
},
|
28
|
+
reason: ({
|
29
|
+
site
|
30
|
+
}) => {
|
31
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
32
|
+
children: ["For a better login experience, we need to apply for the storage permission of the ", site, " site."]
|
33
|
+
});
|
34
|
+
},
|
35
|
+
afterAllow: {
|
36
|
+
title: 'After authorization, you will enjoy:',
|
37
|
+
list1: 'More convenient login experience',
|
38
|
+
list2: 'Faster access speed'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
zh: {
|
42
|
+
allow: '允许',
|
43
|
+
dataUsage: '您的数据仅用于身份认证,不会被收集或用于其他用途。',
|
44
|
+
title: '授权请求',
|
45
|
+
clickAllow: ({
|
46
|
+
allowButton
|
47
|
+
}) => {
|
48
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
49
|
+
children: ["\u60A8\u53EA\u9700\u8981\u70B9\u51FB\u4E0B\u65B9\u7684 ", allowButton, " \u6309\u94AE\uFF0C\u540E\u7EED\u5C06\u4E0D\u4F1A\u518D\u770B\u5230\u8FD9\u4E2A\u8BF7\u6C42\u3002"]
|
50
|
+
});
|
51
|
+
},
|
52
|
+
reason: ({
|
53
|
+
site
|
54
|
+
}) => {
|
55
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
56
|
+
children: ["\u4E3A\u4E86\u8BA9\u60A8\u83B7\u5F97\u66F4\u597D\u7684\u767B\u5F55\u4F53\u9A8C\uFF0C\u6211\u4EEC\u9700\u8981\u7533\u8BF7 ", site, " \u7AD9\u70B9\u5B58\u50A8\u6743\u9650\u3002"]
|
57
|
+
});
|
58
|
+
},
|
59
|
+
afterAllow: {
|
60
|
+
title: '授权后,您将享受:',
|
61
|
+
list1: '更便捷的登录体验',
|
62
|
+
list2: '更快的访问速度'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
const RequestStorageAccessApiDialog = /*#__PURE__*/forwardRef(({
|
67
|
+
locale = 'en',
|
68
|
+
src,
|
69
|
+
storageAccessState,
|
70
|
+
onHandle = noop
|
71
|
+
}, ref) => {
|
72
|
+
const sharedBridgeRef = useRef(null);
|
73
|
+
const currentState = useReactive({
|
74
|
+
callback: noop,
|
75
|
+
open: false,
|
76
|
+
get origin() {
|
77
|
+
try {
|
78
|
+
return new URL(src).origin;
|
79
|
+
} catch (error) {
|
80
|
+
return src;
|
81
|
+
}
|
82
|
+
},
|
83
|
+
get host() {
|
84
|
+
try {
|
85
|
+
return new URL(src).host;
|
86
|
+
} catch (error) {
|
87
|
+
return src;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
const t = useMemoizedFn((key, data = {}) => {
|
92
|
+
return translate(translations, key, locale, 'en', data);
|
93
|
+
});
|
94
|
+
const reset = useMemoizedFn(() => {
|
95
|
+
currentState.open = false;
|
96
|
+
currentState.callback = noop;
|
97
|
+
});
|
98
|
+
const open = useMemoizedFn(() => {
|
99
|
+
currentState.open = true;
|
100
|
+
});
|
101
|
+
const close = useMemoizedFn(() => {
|
102
|
+
currentState.open = false;
|
103
|
+
});
|
104
|
+
const _requestStorageAccess = useMemoizedFn(async callback => {
|
105
|
+
const result = await sharedBridgeRef.current?.callIframe('requestStorageAccess');
|
106
|
+
if (result.value) {
|
107
|
+
callback(true, 'broswer');
|
108
|
+
} else if (storageAccessState === undefined) {
|
109
|
+
// 用户未在当前网页交互过,此时必然需要进行一次弹窗
|
110
|
+
callback(false, 'system');
|
111
|
+
} else if (storageAccessState === 'denied') {
|
112
|
+
// 用户已经明确拒绝过跨站授权,直接弹窗
|
113
|
+
callback(false);
|
114
|
+
} else {
|
115
|
+
// NOTICE: 暂时保留这部分逻辑,后续可能会用上
|
116
|
+
// else if (
|
117
|
+
// result.error?.name === 'NotAllowedError' &&
|
118
|
+
// result.error?.message === 'requestStorageAccess not allowed'
|
119
|
+
// ) {
|
120
|
+
// // 操作被浏览器禁止,需要用户手动与 iframe 交互一次才可以
|
121
|
+
// currentState.open = true;
|
122
|
+
// currentState.callback = callback;
|
123
|
+
// }
|
124
|
+
currentState.open = true;
|
125
|
+
currentState.callback = callback;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
const requestStorageAccess = useMemoizedFn(() => {
|
129
|
+
return new Promise(resolve => {
|
130
|
+
_requestStorageAccess((result, origin) => {
|
131
|
+
reset();
|
132
|
+
resolve({
|
133
|
+
value: result,
|
134
|
+
origin
|
135
|
+
});
|
136
|
+
});
|
137
|
+
});
|
138
|
+
});
|
139
|
+
const handleAllow = useMemoizedFn(() => {
|
140
|
+
currentState.open = false;
|
141
|
+
});
|
142
|
+
const handleClose = useMemoizedFn(() => {
|
143
|
+
currentState.open = false;
|
144
|
+
currentState.callback(false, 'system');
|
145
|
+
});
|
146
|
+
useImperativeHandle(ref, () => ({
|
147
|
+
open,
|
148
|
+
close,
|
149
|
+
requestStorageAccess
|
150
|
+
}));
|
151
|
+
return /*#__PURE__*/_jsx(DIDConnectContainer, {
|
152
|
+
popup: true,
|
153
|
+
open: currentState.open,
|
154
|
+
onClose: handleClose,
|
155
|
+
keepMounted: true,
|
156
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
157
|
+
sx: {
|
158
|
+
backgroundColor: 'background.default',
|
159
|
+
display: 'flex',
|
160
|
+
flexDirection: 'column',
|
161
|
+
height: '100%',
|
162
|
+
position: 'relative',
|
163
|
+
maxWidth: '100%',
|
164
|
+
transition: 'width 0.2s ease-in-out',
|
165
|
+
margin: 'auto',
|
166
|
+
p: 3,
|
167
|
+
gap: 2
|
168
|
+
},
|
169
|
+
children: [/*#__PURE__*/_jsx(CloseButton, {
|
170
|
+
onClose: handleClose,
|
171
|
+
sx: {
|
172
|
+
position: 'absolute',
|
173
|
+
right: 14,
|
174
|
+
top: 14
|
175
|
+
}
|
176
|
+
}), /*#__PURE__*/_jsxs(Typography, {
|
177
|
+
component: "div",
|
178
|
+
variant: "h4",
|
179
|
+
sx: {
|
180
|
+
fontWeight: 700,
|
181
|
+
fontFamily: 'Lexend',
|
182
|
+
display: 'flex',
|
183
|
+
alignItems: 'center',
|
184
|
+
gap: 1
|
185
|
+
},
|
186
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
187
|
+
component: Icon,
|
188
|
+
icon: lockOutlineIcon,
|
189
|
+
fontSize: 28,
|
190
|
+
sx: {
|
191
|
+
color: 'warning.main'
|
192
|
+
}
|
193
|
+
}), t('title')]
|
194
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
195
|
+
sx: {
|
196
|
+
display: 'flex',
|
197
|
+
flexDirection: 'column',
|
198
|
+
gap: 1
|
199
|
+
},
|
200
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
201
|
+
children: t('reason', {
|
202
|
+
site: /*#__PURE__*/_jsx(Chip, {
|
203
|
+
clickable: true,
|
204
|
+
component: "a",
|
205
|
+
href: currentState.origin,
|
206
|
+
label: currentState.host,
|
207
|
+
size: "small",
|
208
|
+
deleteIcon: /*#__PURE__*/_jsx(Icon, {
|
209
|
+
icon: externalLinkIcon
|
210
|
+
}),
|
211
|
+
onDelete: () => {},
|
212
|
+
target: "_blank"
|
213
|
+
})
|
214
|
+
})
|
215
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
216
|
+
component: "div",
|
217
|
+
children: t('clickAllow', {
|
218
|
+
allowButton: /*#__PURE__*/_jsx(Chip, {
|
219
|
+
label: t('allow'),
|
220
|
+
size: "small",
|
221
|
+
color: "success"
|
222
|
+
})
|
223
|
+
})
|
224
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
225
|
+
sx: {
|
226
|
+
mt: 2
|
227
|
+
},
|
228
|
+
children: [/*#__PURE__*/_jsxs(Typography, {
|
229
|
+
sx: {
|
230
|
+
display: 'flex',
|
231
|
+
alignItems: 'center',
|
232
|
+
gap: 1,
|
233
|
+
mb: 0.5
|
234
|
+
},
|
235
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
236
|
+
component: Icon,
|
237
|
+
icon: checkCircleIcon,
|
238
|
+
fontSize: 24,
|
239
|
+
sx: {
|
240
|
+
color: 'success.main'
|
241
|
+
}
|
242
|
+
}), t('afterAllow.title')]
|
243
|
+
}), /*#__PURE__*/_jsxs(List, {
|
244
|
+
dense: true,
|
245
|
+
sx: {
|
246
|
+
py: 0,
|
247
|
+
pl: 2
|
248
|
+
},
|
249
|
+
children: [/*#__PURE__*/_jsxs(ListItem, {
|
250
|
+
sx: {
|
251
|
+
display: 'flex',
|
252
|
+
alignItems: 'center',
|
253
|
+
gap: 0.8
|
254
|
+
},
|
255
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
256
|
+
component: Icon,
|
257
|
+
icon: rocketLaunchRoundedIcon,
|
258
|
+
fontSize: 20,
|
259
|
+
sx: {
|
260
|
+
color: 'success.main'
|
261
|
+
}
|
262
|
+
}), t('afterAllow.list1')]
|
263
|
+
}), /*#__PURE__*/_jsxs(ListItem, {
|
264
|
+
sx: {
|
265
|
+
display: 'flex',
|
266
|
+
alignItems: 'center',
|
267
|
+
gap: 0.8
|
268
|
+
},
|
269
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
270
|
+
component: Icon,
|
271
|
+
icon: rocketLaunchRoundedIcon,
|
272
|
+
fontSize: 20,
|
273
|
+
sx: {
|
274
|
+
color: 'success.main'
|
275
|
+
}
|
276
|
+
}), t('afterAllow.list2')]
|
277
|
+
})]
|
278
|
+
})]
|
279
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
280
|
+
component: "div",
|
281
|
+
variant: "body2",
|
282
|
+
color: "grey.700",
|
283
|
+
children: t('dataUsage')
|
284
|
+
})]
|
285
|
+
}), /*#__PURE__*/_jsx(Box, {
|
286
|
+
sx: {
|
287
|
+
display: 'flex',
|
288
|
+
justifyContent: 'center'
|
289
|
+
},
|
290
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
291
|
+
sx: {
|
292
|
+
position: 'relative',
|
293
|
+
display: 'inline-block',
|
294
|
+
cursor: 'pointer'
|
295
|
+
},
|
296
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
297
|
+
variant: "contained",
|
298
|
+
color: "success",
|
299
|
+
onClick: handleAllow,
|
300
|
+
sx: {
|
301
|
+
minWidth: 100,
|
302
|
+
letterSpacing: 1
|
303
|
+
},
|
304
|
+
children: t('allow')
|
305
|
+
}), /*#__PURE__*/_jsx(SharedBridge, {
|
306
|
+
ref: sharedBridgeRef,
|
307
|
+
onClick: ({
|
308
|
+
value,
|
309
|
+
visitorId
|
310
|
+
}) => {
|
311
|
+
if (visitorId) setVisitorId(visitorId);
|
312
|
+
currentState.callback(value, 'broswer');
|
313
|
+
},
|
314
|
+
locale: locale,
|
315
|
+
src: src,
|
316
|
+
sx: {
|
317
|
+
zIndex: 1
|
318
|
+
}
|
319
|
+
})]
|
320
|
+
})
|
321
|
+
})]
|
322
|
+
})
|
323
|
+
});
|
324
|
+
});
|
325
|
+
export default /*#__PURE__*/memo(RequestStorageAccessApiDialog);
|
@@ -11,5 +11,6 @@ export interface RelativeTimeProps {
|
|
11
11
|
relativeRange?: number;
|
12
12
|
enableTooltip?: boolean;
|
13
13
|
showUTCPrefix?: boolean;
|
14
|
+
disableUTC?: boolean;
|
14
15
|
}
|
15
|
-
export default function RelativeTime({ value, locale, withoutSuffix, from, to, type, tz, relativeRange, enableTooltip, showUTCPrefix, ...rest }: RelativeTimeProps): import("react/jsx-runtime").JSX.Element;
|
16
|
+
export default function RelativeTime({ value, locale, withoutSuffix, from, to, type, tz, relativeRange, enableTooltip, showUTCPrefix, disableUTC, ...rest }: RelativeTimeProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { Box, Tooltip } from '@mui/material';
|
3
|
-
import { useState } from 'react';
|
3
|
+
import { useState, useMemo } from 'react';
|
4
4
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
5
5
|
import dayjs from 'dayjs';
|
6
6
|
import 'dayjs/locale/zh-cn';
|
@@ -136,7 +136,15 @@ function UTCChip({
|
|
136
136
|
setIsUtc,
|
137
137
|
showUTCPrefix = true
|
138
138
|
}) {
|
139
|
-
const prefix =
|
139
|
+
const prefix = useMemo(() => {
|
140
|
+
if (showUTCPrefix) {
|
141
|
+
if (isUtc) {
|
142
|
+
return '';
|
143
|
+
}
|
144
|
+
return `${translations[locale].utc}: `;
|
145
|
+
}
|
146
|
+
return '';
|
147
|
+
}, [locale, showUTCPrefix, isUtc]);
|
140
148
|
return /*#__PURE__*/_jsx(Box, {
|
141
149
|
component: "span",
|
142
150
|
sx: {
|
@@ -164,6 +172,7 @@ export default function RelativeTime({
|
|
164
172
|
relativeRange,
|
165
173
|
enableTooltip = true,
|
166
174
|
showUTCPrefix = true,
|
175
|
+
disableUTC = false,
|
167
176
|
...rest
|
168
177
|
}) {
|
169
178
|
const {
|
@@ -190,10 +199,9 @@ export default function RelativeTime({
|
|
190
199
|
placement: "top-end",
|
191
200
|
enterTouchDelay: 0,
|
192
201
|
children: /*#__PURE__*/_jsxs(Box, {
|
193
|
-
display: "flex",
|
202
|
+
display: "inline-flex",
|
194
203
|
alignItems: "center",
|
195
204
|
gap: 0.5,
|
196
|
-
width: "max-content",
|
197
205
|
...rest,
|
198
206
|
children: [/*#__PURE__*/_jsx(Box, {
|
199
207
|
component: "span",
|
@@ -212,19 +220,21 @@ export default function RelativeTime({
|
|
212
220
|
color: 'text.secondary'
|
213
221
|
},
|
214
222
|
children: relativeString
|
215
|
-
}), /*#__PURE__*/
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
223
|
+
}), !disableUTC && /*#__PURE__*/_jsxs(_Fragment, {
|
224
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
225
|
+
component: "span",
|
226
|
+
sx: {
|
227
|
+
color: 'inherit'
|
228
|
+
},
|
229
|
+
children: "\xB7"
|
230
|
+
}), /*#__PURE__*/_jsx(UTCChip, {
|
231
|
+
locale: locale,
|
232
|
+
isUtc: isUtc,
|
233
|
+
sign: sign,
|
234
|
+
hoursOffset: hoursOffset,
|
235
|
+
setIsUtc: setIsUtc,
|
236
|
+
showUTCPrefix: showUTCPrefix
|
237
|
+
})]
|
228
238
|
})]
|
229
239
|
})
|
230
240
|
});
|
@@ -234,15 +244,14 @@ export default function RelativeTime({
|
|
234
244
|
placement: "top-end",
|
235
245
|
enterTouchDelay: 0,
|
236
246
|
children: /*#__PURE__*/_jsxs(Box, {
|
237
|
-
display: "flex",
|
247
|
+
display: "inline-flex",
|
238
248
|
alignItems: "center",
|
239
249
|
gap: 1,
|
240
|
-
width: "max-content",
|
241
250
|
children: [/*#__PURE__*/_jsx(Box, {
|
242
251
|
component: "span",
|
243
252
|
...rest,
|
244
253
|
children: innerContent
|
245
|
-
}), type === 'utc' && /*#__PURE__*/_jsx(UTCChip, {
|
254
|
+
}), type === 'utc' && !disableUTC && /*#__PURE__*/_jsx(UTCChip, {
|
246
255
|
locale: locale,
|
247
256
|
isUtc: isUtc,
|
248
257
|
sign: sign,
|
@@ -14,7 +14,7 @@ import { translations } from '../libs/translation';
|
|
14
14
|
import Typography from '../../Typography';
|
15
15
|
import QuickLoginItem from './quick-login-item';
|
16
16
|
import { getFederatedEnabled, getMaster } from '../../Util/federated';
|
17
|
-
import
|
17
|
+
import { BLOCKLET_SERVICE_PATH_PREFIX } from '../../Util/constant';
|
18
18
|
export default function UnLogin({
|
19
19
|
session,
|
20
20
|
onLogin = noop,
|
@@ -56,7 +56,7 @@ export default function UnLogin({
|
|
56
56
|
const masterSite = getMaster(blocklet);
|
57
57
|
const loginApp = federatedEnabled && masterSite ? masterSite : blocklet;
|
58
58
|
const loginAppName = loginApp?.appName || 'DID Connect';
|
59
|
-
const loginAppLogo = joinURL(loginApp?.appUrl || '/', loginApp?.appLogo ||
|
59
|
+
const loginAppLogo = joinURL(loginApp?.appUrl || '/', loginApp?.appLogo || `${BLOCKLET_SERVICE_PATH_PREFIX}/blocklet/logo?imageFilter=convert&f=png&h=80`);
|
60
60
|
useEffect(() => {
|
61
61
|
let timer;
|
62
62
|
|
@@ -88,42 +88,34 @@ export default function UnLogin({
|
|
88
88
|
}
|
89
89
|
});
|
90
90
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
91
|
-
children: [/*#__PURE__*/_jsx(
|
92
|
-
|
91
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
92
|
+
ref: userAnchorRef,
|
93
|
+
"data-cy": "sessionManager-login",
|
94
|
+
className: "arc-session-user-unlogin",
|
95
|
+
size: "medium",
|
93
96
|
onClick: _onLogin,
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
})
|
117
|
-
}) : /*#__PURE__*/_jsx(Icon, {
|
118
|
-
icon: UserIcon,
|
119
|
-
fontSize: size,
|
120
|
-
color: dark ? '#fff' : 'inherit',
|
121
|
-
style: {
|
122
|
-
transform: 'scale(1.25)'
|
123
|
-
}
|
124
|
-
})
|
125
|
-
});
|
126
|
-
}
|
97
|
+
"aria-label": "Login button",
|
98
|
+
children: isFirstLoading ? /*#__PURE__*/_jsx(Box, {
|
99
|
+
width: size,
|
100
|
+
height: size,
|
101
|
+
display: "flex",
|
102
|
+
justifyContent: "center",
|
103
|
+
alignItems: "center",
|
104
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
105
|
+
style: {
|
106
|
+
width: size - 4,
|
107
|
+
height: size - 4,
|
108
|
+
color: dark ? '#fff' : ''
|
109
|
+
}
|
110
|
+
})
|
111
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
112
|
+
icon: UserIcon,
|
113
|
+
fontSize: size,
|
114
|
+
color: dark ? '#fff' : 'inherit',
|
115
|
+
style: {
|
116
|
+
transform: 'scale(1.25)'
|
117
|
+
}
|
118
|
+
})
|
127
119
|
}), /*#__PURE__*/_jsx(Popper, {
|
128
120
|
open: currentState.open,
|
129
121
|
anchorEl: userAnchorRef.current,
|
@@ -1,16 +1,15 @@
|
|
1
1
|
import type { SxProps } from '@mui/material';
|
2
|
-
import React from 'react';
|
3
2
|
import { Locale } from '../type';
|
4
|
-
declare const
|
3
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
5
4
|
src: string;
|
6
5
|
onClick: (data: {
|
7
6
|
action: string;
|
8
7
|
value: boolean;
|
9
8
|
visitorId?: string;
|
9
|
+
error?: Error;
|
10
10
|
}) => void;
|
11
|
-
onLoad
|
11
|
+
onLoad?: () => void;
|
12
12
|
sx?: SxProps;
|
13
|
-
iframeRef?: React.RefObject<HTMLIFrameElement>;
|
14
13
|
locale?: Locale;
|
15
|
-
}
|
16
|
-
export default
|
14
|
+
} & import("react").RefAttributes<unknown>>>;
|
15
|
+
export default _default;
|