@arcblock/ux 2.13.50 → 2.13.52
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.
@@ -64,20 +64,35 @@ export default function LoggedIn({
|
|
64
64
|
// FIXME: @zhanghan this should be refactored into SessionContext
|
65
65
|
const oauth = session.useOAuth();
|
66
66
|
const passkey = typeof session.usePasskey === 'function' ? session.usePasskey() : null;
|
67
|
-
const handleSwitchPassport = useMemoizedFn((
|
67
|
+
const handleSwitchPassport = useMemoizedFn(({
|
68
|
+
inArcSphere = false
|
69
|
+
} = {}) => {
|
70
|
+
const extraParams = {};
|
71
|
+
if (inArcSphere) {
|
72
|
+
if (session?.user?.sourceAppPid) {
|
73
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
74
|
+
}
|
75
|
+
}
|
68
76
|
onTogglePopper(false);
|
69
77
|
if (session?.user?.sourceProvider === 'passkey') {
|
70
78
|
passkey.switchPassport(session.user);
|
71
79
|
} else if (['google', 'apple', 'email', 'github'].includes(session?.user?.sourceProvider)) {
|
72
80
|
oauth.switchOAuthPassport(session.user);
|
73
81
|
} else {
|
74
|
-
session.switchPassport();
|
82
|
+
session.switchPassport(noop, extraParams);
|
75
83
|
}
|
76
84
|
});
|
77
85
|
const handleSwitchAccount = useMemoizedFn(({
|
78
|
-
userSession
|
86
|
+
userSession,
|
87
|
+
inArcSphere = false
|
79
88
|
} = {}) => {
|
80
89
|
return new Promise(resolve => {
|
90
|
+
const extraParams = {};
|
91
|
+
if (inArcSphere) {
|
92
|
+
if (session.user.sourceAppPid) {
|
93
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
94
|
+
}
|
95
|
+
}
|
81
96
|
const options = {};
|
82
97
|
if (!userSession) {
|
83
98
|
onTogglePopper(false);
|
@@ -88,12 +103,20 @@ export default function LoggedIn({
|
|
88
103
|
session.switchDid(() => {
|
89
104
|
onTogglePopper(false);
|
90
105
|
resolve();
|
91
|
-
},
|
106
|
+
}, extraParams, options);
|
92
107
|
});
|
93
108
|
});
|
94
|
-
const handleSwitchProfile = useMemoizedFn((
|
109
|
+
const handleSwitchProfile = useMemoizedFn(({
|
110
|
+
inArcSphere = false
|
111
|
+
} = {}) => {
|
112
|
+
const extraParams = {};
|
113
|
+
if (inArcSphere) {
|
114
|
+
if (session.user.sourceAppPid) {
|
115
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
116
|
+
}
|
117
|
+
}
|
95
118
|
onTogglePopper(false);
|
96
|
-
session.switchProfile();
|
119
|
+
session.switchProfile(noop, extraParams);
|
97
120
|
});
|
98
121
|
const onLogout = useMemoizedFn(() => {
|
99
122
|
onTogglePopper(false);
|
@@ -112,15 +135,21 @@ export default function LoggedIn({
|
|
112
135
|
useEffect(() => {
|
113
136
|
bridge.registerBlocklet('callSwitchPassport', () => {
|
114
137
|
debug('bridge registerBlocklet: callSwitchPassport');
|
115
|
-
handleSwitchPassport(
|
138
|
+
handleSwitchPassport({
|
139
|
+
inArcSphere: true
|
140
|
+
});
|
116
141
|
});
|
117
142
|
bridge.registerBlocklet('callSwitchDid', () => {
|
118
143
|
debug('bridge registerBlocklet: callSwitchDid');
|
119
|
-
handleSwitchAccount(
|
144
|
+
handleSwitchAccount({
|
145
|
+
inArcSphere: true
|
146
|
+
});
|
120
147
|
});
|
121
148
|
bridge.registerBlocklet('callSwitchProfile', () => {
|
122
149
|
debug('bridge registerBlocklet: callSwitchProfile');
|
123
|
-
handleSwitchProfile(
|
150
|
+
handleSwitchProfile({
|
151
|
+
inArcSphere: true
|
152
|
+
});
|
124
153
|
});
|
125
154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
126
155
|
}, []);
|
@@ -153,7 +182,10 @@ export default function LoggedIn({
|
|
153
182
|
transition: true,
|
154
183
|
placement: "bottom-end",
|
155
184
|
sx: {
|
156
|
-
zIndex: 1600
|
185
|
+
zIndex: 1600,
|
186
|
+
'> div': {
|
187
|
+
boxShadow: theme => theme.palette.mode === 'dark' ? `${theme.shadows[2]}, inset 0 0 0 1px rgba(255, 255, 255, 0.05)` : theme.shadows[2]
|
188
|
+
}
|
157
189
|
},
|
158
190
|
children: ({
|
159
191
|
TransitionProps
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.13.
|
3
|
+
"version": "2.13.52",
|
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": "
|
74
|
+
"gitHead": "93f8622a2df8d7408d16ea1432e28a419f051c61",
|
75
75
|
"dependencies": {
|
76
76
|
"@arcblock/did-motif": "^1.1.13",
|
77
|
-
"@arcblock/icons": "^2.13.
|
78
|
-
"@arcblock/nft-display": "^2.13.
|
79
|
-
"@arcblock/react-hooks": "^2.13.
|
77
|
+
"@arcblock/icons": "^2.13.52",
|
78
|
+
"@arcblock/nft-display": "^2.13.52",
|
79
|
+
"@arcblock/react-hooks": "^2.13.52",
|
80
80
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
81
|
-
"@blocklet/theme": "^2.13.
|
81
|
+
"@blocklet/theme": "^2.13.52",
|
82
82
|
"@fontsource/roboto": "~5.1.1",
|
83
83
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
84
84
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -87,19 +87,31 @@ export default function LoggedIn({
|
|
87
87
|
// FIXME: @zhanghan this should be refactored into SessionContext
|
88
88
|
const oauth = session.useOAuth();
|
89
89
|
const passkey = typeof session.usePasskey === 'function' ? session.usePasskey() : null;
|
90
|
-
const handleSwitchPassport = useMemoizedFn(() => {
|
90
|
+
const handleSwitchPassport = useMemoizedFn(({ inArcSphere = false } = {}) => {
|
91
|
+
const extraParams: Record<string, any> = {};
|
92
|
+
if (inArcSphere) {
|
93
|
+
if (session?.user?.sourceAppPid) {
|
94
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
95
|
+
}
|
96
|
+
}
|
91
97
|
onTogglePopper(false);
|
92
98
|
if (session?.user?.sourceProvider === 'passkey') {
|
93
99
|
passkey.switchPassport(session.user);
|
94
100
|
} else if (['google', 'apple', 'email', 'github'].includes(session?.user?.sourceProvider)) {
|
95
101
|
oauth.switchOAuthPassport(session.user);
|
96
102
|
} else {
|
97
|
-
session.switchPassport();
|
103
|
+
session.switchPassport(noop, extraParams);
|
98
104
|
}
|
99
105
|
});
|
100
106
|
|
101
|
-
const handleSwitchAccount = useMemoizedFn(({ userSession } = {}) => {
|
107
|
+
const handleSwitchAccount = useMemoizedFn(({ userSession, inArcSphere = false } = {}) => {
|
102
108
|
return new Promise<void>((resolve) => {
|
109
|
+
const extraParams: Record<string, any> = {};
|
110
|
+
if (inArcSphere) {
|
111
|
+
if (session.user.sourceAppPid) {
|
112
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
113
|
+
}
|
114
|
+
}
|
103
115
|
const options: Record<string, any> = {};
|
104
116
|
if (!userSession) {
|
105
117
|
onTogglePopper(false);
|
@@ -112,14 +124,20 @@ export default function LoggedIn({
|
|
112
124
|
onTogglePopper(false);
|
113
125
|
resolve();
|
114
126
|
},
|
115
|
-
|
127
|
+
extraParams,
|
116
128
|
options
|
117
129
|
);
|
118
130
|
});
|
119
131
|
});
|
120
|
-
const handleSwitchProfile = useMemoizedFn(() => {
|
132
|
+
const handleSwitchProfile = useMemoizedFn(({ inArcSphere = false } = {}) => {
|
133
|
+
const extraParams: Record<string, any> = {};
|
134
|
+
if (inArcSphere) {
|
135
|
+
if (session.user.sourceAppPid) {
|
136
|
+
extraParams.sourceAppPid = session.user.sourceAppPid;
|
137
|
+
}
|
138
|
+
}
|
121
139
|
onTogglePopper(false);
|
122
|
-
session.switchProfile();
|
140
|
+
session.switchProfile(noop, extraParams);
|
123
141
|
});
|
124
142
|
const onLogout = useMemoizedFn(() => {
|
125
143
|
onTogglePopper(false);
|
@@ -141,15 +159,15 @@ export default function LoggedIn({
|
|
141
159
|
useEffect(() => {
|
142
160
|
bridge.registerBlocklet('callSwitchPassport', () => {
|
143
161
|
debug('bridge registerBlocklet: callSwitchPassport');
|
144
|
-
handleSwitchPassport();
|
162
|
+
handleSwitchPassport({ inArcSphere: true });
|
145
163
|
});
|
146
164
|
bridge.registerBlocklet('callSwitchDid', () => {
|
147
165
|
debug('bridge registerBlocklet: callSwitchDid');
|
148
|
-
handleSwitchAccount();
|
166
|
+
handleSwitchAccount({ inArcSphere: true });
|
149
167
|
});
|
150
168
|
bridge.registerBlocklet('callSwitchProfile', () => {
|
151
169
|
debug('bridge registerBlocklet: callSwitchProfile');
|
152
|
-
handleSwitchProfile();
|
170
|
+
handleSwitchProfile({ inArcSphere: true });
|
153
171
|
});
|
154
172
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
155
173
|
}, []);
|
@@ -181,7 +199,15 @@ export default function LoggedIn({
|
|
181
199
|
anchorEl={popperAnchorRef.current}
|
182
200
|
transition
|
183
201
|
placement="bottom-end"
|
184
|
-
sx={{
|
202
|
+
sx={{
|
203
|
+
zIndex: 1600,
|
204
|
+
'> div': {
|
205
|
+
boxShadow: (theme) =>
|
206
|
+
theme.palette.mode === 'dark'
|
207
|
+
? `${theme.shadows[2]}, inset 0 0 0 1px rgba(255, 255, 255, 0.05)`
|
208
|
+
: theme.shadows[2],
|
209
|
+
},
|
210
|
+
}}>
|
185
211
|
{({ TransitionProps }) => (
|
186
212
|
<ClickAwayListener
|
187
213
|
onClickAway={(e) => {
|