@arcblock/ux 2.13.15 → 2.13.17

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.
@@ -24,7 +24,10 @@ export default function UserInfo({
24
24
  return translate(translations, key, locale, 'en', data);
25
25
  });
26
26
  const avatar = getUserAvatar(session.user?.avatar?.replace(/\s/g, encodeURIComponent(' ')), 64);
27
- const currentRole = useCreation(() => session.user?.passports?.find(item => item.name === session.user.role), [session?.user?.passports, session?.user?.role]);
27
+ const currentRole = useCreation(() => {
28
+ // FIXME: @zhanghan 感觉应该把 name 的判断去掉?
29
+ return session.user?.passports?.find(item => item.name === session.user.role || item.role === session.user.role);
30
+ }, [session?.user?.passports, session?.user?.role]);
28
31
  const hasBindWallet = useCreation(() => {
29
32
  return getWallet(session?.user);
30
33
  }, [session?.user]);
@@ -20,6 +20,7 @@ const SharedBridge = /*#__PURE__*/memo(function SharedBridge({
20
20
  const refId = useId();
21
21
  const dataId = `shared-bridge_${refId}`;
22
22
  const currentState = useReactive({
23
+ hasInited: undefined,
23
24
  open: false,
24
25
  hasStorageAccess: false,
25
26
  get origin() {
@@ -72,10 +73,22 @@ const SharedBridge = /*#__PURE__*/memo(function SharedBridge({
72
73
  value
73
74
  }) => {
74
75
  currentState.hasStorageAccess = value;
76
+ currentState.hasInited = true;
75
77
  });
78
+ setTimeout(() => {
79
+ if (currentState.hasInited === undefined) {
80
+ currentState.hasInited = false;
81
+ }
82
+ }, 1000);
76
83
  onLoad();
77
84
  });
78
- return currentState.hasStorageAccess ? null : /*#__PURE__*/_jsxs(_Fragment, {
85
+ if (currentState.hasInited === false) {
86
+ return null;
87
+ }
88
+ if (currentState.hasStorageAccess) {
89
+ return null;
90
+ }
91
+ return /*#__PURE__*/_jsxs(_Fragment, {
79
92
  children: [/*#__PURE__*/_jsx(DialogComponent, {
80
93
  popup: true,
81
94
  locale: locale,
@@ -101,7 +114,8 @@ const SharedBridge = /*#__PURE__*/memo(function SharedBridge({
101
114
  left: 0,
102
115
  width: '100%',
103
116
  height: '100%',
104
- cursor: 'pointer'
117
+ cursor: 'pointer',
118
+ opacity: 0
105
119
  }, sx)
106
120
  })]
107
121
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.15",
3
+ "version": "2.13.17",
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": "94d15cfb22e13272502bb40863c5b059cb13eab5",
74
+ "gitHead": "cd775f10e9f90ed9813c8fd401fdae7c327c9c44",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.15",
78
- "@arcblock/nft-display": "^2.13.15",
79
- "@arcblock/react-hooks": "^2.13.15",
77
+ "@arcblock/icons": "^2.13.17",
78
+ "@arcblock/nft-display": "^2.13.17",
79
+ "@arcblock/react-hooks": "^2.13.17",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.15",
81
+ "@blocklet/theme": "^2.13.17",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",
@@ -36,10 +36,12 @@ export default function UserInfo({
36
36
  return translate(translations, key, locale, 'en', data);
37
37
  });
38
38
  const avatar = getUserAvatar(session.user?.avatar?.replace(/\s/g, encodeURIComponent(' ')), 64);
39
- const currentRole = useCreation(
40
- () => session.user?.passports?.find((item: $TSFixMe) => item.name === session.user.role),
41
- [session?.user?.passports, session?.user?.role]
42
- );
39
+ const currentRole = useCreation(() => {
40
+ // FIXME: @zhanghan 感觉应该把 name 的判断去掉?
41
+ return session.user?.passports?.find(
42
+ (item: $TSFixMe) => item.name === session.user.role || item.role === session.user.role
43
+ );
44
+ }, [session?.user?.passports, session?.user?.role]);
43
45
 
44
46
  const hasBindWallet = useCreation(() => {
45
47
  return getWallet(session?.user);
@@ -29,7 +29,14 @@ const SharedBridge = memo(function SharedBridge({
29
29
  const _iframeRef = useRef<HTMLIFrameElement>(null);
30
30
  const refId = useId();
31
31
  const dataId = `shared-bridge_${refId}`;
32
- const currentState = useReactive({
32
+ const currentState = useReactive<{
33
+ hasInited?: boolean;
34
+ open: boolean;
35
+ hasStorageAccess: boolean;
36
+ origin: string;
37
+ host: string;
38
+ }>({
39
+ hasInited: undefined,
33
40
  open: false,
34
41
  hasStorageAccess: false,
35
42
  get origin() {
@@ -80,11 +87,25 @@ const SharedBridge = memo(function SharedBridge({
80
87
  const handleLoad = useMemoizedFn(() => {
81
88
  callIframe(targetIframeRef.current as HTMLIFrameElement, 'hasStorageAccess').then(({ value }) => {
82
89
  currentState.hasStorageAccess = value;
90
+ currentState.hasInited = true;
83
91
  });
92
+ setTimeout(() => {
93
+ if (currentState.hasInited === undefined) {
94
+ currentState.hasInited = false;
95
+ }
96
+ }, 1000);
84
97
  onLoad();
85
98
  });
86
99
 
87
- return currentState.hasStorageAccess ? null : (
100
+ if (currentState.hasInited === false) {
101
+ return null;
102
+ }
103
+
104
+ if (currentState.hasStorageAccess) {
105
+ return null;
106
+ }
107
+
108
+ return (
88
109
  <>
89
110
  <DialogComponent
90
111
  popup
@@ -112,6 +133,7 @@ const SharedBridge = memo(function SharedBridge({
112
133
  width: '100%',
113
134
  height: '100%',
114
135
  cursor: 'pointer',
136
+ opacity: 0,
115
137
  },
116
138
  sx
117
139
  )}