@blocklet/ui-react 2.13.4 → 2.13.5

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.
@@ -48,6 +48,7 @@ export default function DangerZone() {
48
48
  confirm: t("destroyMyself.confirm"),
49
49
  success: t("destroyMyself.success")
50
50
  },
51
+ // @ts-expect-error 该 did-connect 后端api 将结果塞在了 result 中,并做了加密,所以已经变成一个字符串了
51
52
  onSuccess: ({ result }, decrypt = (x) => x) => {
52
53
  const decryptResult = decrypt(result);
53
54
  resolve(decryptResult);
@@ -9,7 +9,7 @@ export default function UserSessions({ user, showAction, showUser, getUserSessio
9
9
  readonly getUserSessions: (params: {
10
10
  page: number;
11
11
  pageSize: number;
12
- status: string;
12
+ status?: 'online' | 'expired';
13
13
  }) => Promise<{
14
14
  paging: {
15
15
  total: number;
@@ -126,7 +126,11 @@ export default function UserSessions({
126
126
  },
127
127
  cancelButtonText: t("cancel"),
128
128
  onConfirm: async () => {
129
- await client.user.logout({ visitorId });
129
+ await client.user.logout({
130
+ visitorId,
131
+ // @ts-expect-error js-sdk 1.16.43 中会包含这个参数
132
+ includeFederated: true
133
+ });
130
134
  pageState.refresh();
131
135
  confirmApi.close();
132
136
  }
@@ -147,9 +151,10 @@ export default function UserSessions({
147
151
  cancelButtonText: t("cancel"),
148
152
  onConfirm: async () => {
149
153
  await client.user.logout({
150
- // @ts-expect-error js-sdk 发了新版后,会有这个类型定义
151
154
  status: filterParams.status,
152
- visitorId: currentVisitorId
155
+ visitorId: currentVisitorId,
156
+ // @ts-expect-error js-sdk 1.16.43 中会包含这个参数
157
+ includeFederated: true
153
158
  });
154
159
  pageState.refresh();
155
160
  confirmApi.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.13.4",
3
+ "version": "2.13.5",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@abtnode/constant": "^1.16.42",
36
36
  "@abtnode/util": "^1.16.42",
37
- "@arcblock/bridge": "^2.13.4",
38
- "@arcblock/react-hooks": "^2.13.4",
37
+ "@arcblock/bridge": "^2.13.5",
38
+ "@arcblock/react-hooks": "^2.13.5",
39
39
  "@arcblock/ws": "^1.20.1",
40
40
  "@blocklet/constant": "^1.16.42",
41
41
  "@blocklet/did-space-react": "^1.0.48",
@@ -94,5 +94,5 @@
94
94
  "jest": "^29.7.0",
95
95
  "unbuild": "^2.0.0"
96
96
  },
97
- "gitHead": "c41220412330b6bc0cd20482261c501beb7ddd34"
97
+ "gitHead": "87e3a4b58baa0ebfd7d4ddb7c367b77eb170f679"
98
98
  }
@@ -7,6 +7,7 @@ import { useConfirm } from '@arcblock/ux/lib/Dialog';
7
7
  import { SessionContext } from '@arcblock/did-connect/lib/Session';
8
8
  import { LOGIN_PROVIDER } from '@blocklet/constant';
9
9
  import Toast from '@arcblock/ux/lib/Toast';
10
+ import type { ConnectProps } from '@arcblock/did-connect/lib/types';
10
11
 
11
12
  import { translations } from '../libs/locales';
12
13
  import { client } from '../../libs/client';
@@ -37,7 +38,7 @@ export default function DangerZone() {
37
38
  return new Promise<{ did: string }>((resolve, reject) => {
38
39
  const userDid = session?.user?.did;
39
40
  connectApi.open({
40
- locale,
41
+ locale: locale as ConnectProps['locale'],
41
42
  action: 'destroy-myself',
42
43
  forceConnected: true,
43
44
  saveConnect: false,
@@ -53,6 +54,7 @@ export default function DangerZone() {
53
54
  confirm: t('destroyMyself.confirm'),
54
55
  success: t('destroyMyself.success'),
55
56
  },
57
+ // @ts-expect-error 该 did-connect 后端api 将结果塞在了 result 中,并做了加密,所以已经变成一个字符串了
56
58
  onSuccess: ({ result }: { result: string }, decrypt = (x: string) => x) => {
57
59
  const decryptResult = decrypt(result) as unknown as { did: string };
58
60
  resolve(decryptResult);
@@ -79,10 +81,7 @@ export default function DangerZone() {
79
81
  try {
80
82
  if (isNeedVerify) {
81
83
  result = await handleVerify();
82
- // TODO: 等 js-sdk 新版后,就有这个方法,可以删除注释
83
- // @ts-ignore
84
84
  } else if (client?.user?.destroyMyself instanceof Function) {
85
- // @ts-ignore
86
85
  result = await client.user.destroyMyself();
87
86
  } else {
88
87
  Toast.error(t('notImplemented'));
@@ -73,11 +73,7 @@ export default function Settings({
73
73
  <UserSessions
74
74
  user={user}
75
75
  showUser={false}
76
- // FIXME: @zhanghan 暂时忽略类型不对的问题 (js-sdk 新版发布后,此处的类型就正确了)
77
- // @ts-ignore
78
76
  getUserSessions={(params) => {
79
- // FIXME: @zhanghan 暂时忽略类型不对的问题 (js-sdk 新版发布后,此处的类型就正确了)
80
- // @ts-ignore
81
77
  return client.userSession.getMyLoginSessions({}, params);
82
78
  }}
83
79
  />
@@ -94,7 +94,7 @@ export default function UserSessions({
94
94
  };
95
95
  readonly showAction?: boolean;
96
96
  readonly showUser?: boolean;
97
- readonly getUserSessions: (params: { page: number; pageSize: number; status: string }) => Promise<{
97
+ readonly getUserSessions: (params: { page: number; pageSize: number; status?: 'online' | 'expired' }) => Promise<{
98
98
  paging: {
99
99
  total: number;
100
100
  };
@@ -122,7 +122,7 @@ export default function UserSessions({
122
122
  const result = await getUserSessions({
123
123
  page: filterParams.page,
124
124
  pageSize: filterParams.pageSize,
125
- status: filterParams.status,
125
+ status: filterParams.status as 'online' | 'expired',
126
126
  });
127
127
 
128
128
  const total = result?.paging?.total || 0;
@@ -171,7 +171,11 @@ export default function UserSessions({
171
171
  },
172
172
  cancelButtonText: t('cancel'),
173
173
  onConfirm: async () => {
174
- await client.user.logout({ visitorId });
174
+ await client.user.logout({
175
+ visitorId,
176
+ // @ts-expect-error js-sdk 1.16.43 中会包含这个参数
177
+ includeFederated: true,
178
+ });
175
179
  pageState.refresh();
176
180
  confirmApi.close();
177
181
  },
@@ -192,9 +196,10 @@ export default function UserSessions({
192
196
  cancelButtonText: t('cancel'),
193
197
  onConfirm: async () => {
194
198
  await client.user.logout({
195
- // @ts-expect-error js-sdk 发了新版后,会有这个类型定义
196
199
  status: filterParams.status,
197
200
  visitorId: currentVisitorId as string,
201
+ // @ts-expect-error js-sdk 1.16.43 中会包含这个参数
202
+ includeFederated: true,
198
203
  });
199
204
  pageState.refresh();
200
205
  confirmApi.close();