@arcblock/ux 2.13.49 → 2.13.50

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.
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef } from 'react';
2
+ import { useEffect, useRef } from 'react';
3
3
  import { useCreation, useMemoizedFn, useReactive } from 'ahooks';
4
+ import bridge from '@arcblock/bridge';
4
5
  import { Box, ClickAwayListener, Divider, Fade, IconButton, MenuItem, MenuList, Paper, Popper } from '@mui/material';
5
6
  import { Icon } from '@iconify/react';
6
7
  import PersonOutlineRoundedIcon from '@iconify-icons/material-symbols/person-outline-rounded';
@@ -19,11 +20,13 @@ import { translations } from '../libs/translation';
19
20
  import { translate } from '../../Locale/util';
20
21
  import DidSpace from './did-space';
21
22
  import { mergeSx } from '../../Util/style';
23
+ import { createDebug } from '../../Util/logger';
22
24
  const getInviteLink = inviter => {
23
25
  const url = new URL(window.location.href);
24
26
  url.searchParams.set('inviter', inviter);
25
27
  return url.toString();
26
28
  };
29
+ const debug = createDebug('did-connect');
27
30
  export default function LoggedIn({
28
31
  session,
29
32
  dark = false,
@@ -106,6 +109,21 @@ export default function LoggedIn({
106
109
  Copy(link);
107
110
  Toast.success(t('inviteCopied'));
108
111
  });
112
+ useEffect(() => {
113
+ bridge.registerBlocklet('callSwitchPassport', () => {
114
+ debug('bridge registerBlocklet: callSwitchPassport');
115
+ handleSwitchPassport();
116
+ });
117
+ bridge.registerBlocklet('callSwitchDid', () => {
118
+ debug('bridge registerBlocklet: callSwitchDid');
119
+ handleSwitchAccount();
120
+ });
121
+ bridge.registerBlocklet('callSwitchProfile', () => {
122
+ debug('bridge registerBlocklet: callSwitchProfile');
123
+ handleSwitchProfile();
124
+ });
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ }, []);
109
127
  return /*#__PURE__*/_jsxs(Box, {
110
128
  sx: mergeSx({
111
129
  display: 'inline-flex',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.49",
3
+ "version": "2.13.50",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -71,14 +71,14 @@
71
71
  "react": ">=18.2.0",
72
72
  "react-router-dom": ">=6.22.3"
73
73
  },
74
- "gitHead": "a924ed1c40a2ca8fea2f50bea4de423d04aadd88",
74
+ "gitHead": "ab8b54c8b1de7f58cdd9a9f95f1a5afb0650c335",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.49",
78
- "@arcblock/nft-display": "^2.13.49",
79
- "@arcblock/react-hooks": "^2.13.49",
77
+ "@arcblock/icons": "^2.13.50",
78
+ "@arcblock/nft-display": "^2.13.50",
79
+ "@arcblock/react-hooks": "^2.13.50",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.49",
81
+ "@blocklet/theme": "^2.13.50",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",
@@ -1,5 +1,6 @@
1
- import { ElementType, useRef } from 'react';
1
+ import { ElementType, useEffect, useRef } from 'react';
2
2
  import { useCreation, useMemoizedFn, useReactive } from 'ahooks';
3
+ import bridge from '@arcblock/bridge';
3
4
  import {
4
5
  Box,
5
6
  type BoxProps,
@@ -31,6 +32,7 @@ import { translate } from '../../Locale/util';
31
32
  import type { Locale, Session } from '../../type';
32
33
  import DidSpace from './did-space';
33
34
  import { mergeSx } from '../../Util/style';
35
+ import { createDebug } from '../../Util/logger';
34
36
 
35
37
  const getInviteLink = (inviter: string) => {
36
38
  const url = new URL(window.location.href);
@@ -38,6 +40,8 @@ const getInviteLink = (inviter: string) => {
38
40
  return url.toString();
39
41
  };
40
42
 
43
+ const debug = createDebug('did-connect');
44
+
41
45
  export interface LoggedInProps extends Omit<BoxProps, 'onClick' | 'onMouseEnter' | 'onMouseLeave'> {
42
46
  session: Session;
43
47
  dark?: false | true;
@@ -134,6 +138,22 @@ export default function LoggedIn({
134
138
  Toast.success(t('inviteCopied'));
135
139
  });
136
140
 
141
+ useEffect(() => {
142
+ bridge.registerBlocklet('callSwitchPassport', () => {
143
+ debug('bridge registerBlocklet: callSwitchPassport');
144
+ handleSwitchPassport();
145
+ });
146
+ bridge.registerBlocklet('callSwitchDid', () => {
147
+ debug('bridge registerBlocklet: callSwitchDid');
148
+ handleSwitchAccount();
149
+ });
150
+ bridge.registerBlocklet('callSwitchProfile', () => {
151
+ debug('bridge registerBlocklet: callSwitchProfile');
152
+ handleSwitchProfile();
153
+ });
154
+ // eslint-disable-next-line react-hooks/exhaustive-deps
155
+ }, []);
156
+
137
157
  return (
138
158
  <Box
139
159
  sx={mergeSx(